ModelViewTable.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef MODELVIEWTABLE_H
  2. #define MODELVIEWTABLE_H
  3. #include <QDialog>
  4. #include <QFrame>
  5. #include <QStackedWidget>
  6. #include <QStandardItemModel>
  7. #include <QHBoxLayout>
  8. #include <QVBoxLayout>
  9. #include <QPushButton>
  10. #include <QTableView>
  11. #include "dbService/ClassSet.h"
  12. namespace Ui {
  13. class ModelViewTable;
  14. }
  15. class ModelViewTable : public QWidget
  16. {
  17. Q_OBJECT
  18. public:
  19. explicit ModelViewTable(QWidget *parent = nullptr);
  20. ~ModelViewTable();
  21. void init(QList<NodeMatrixInfo *> &infos);
  22. void setIndexForMessaureMethods(QStringList methods) { indexForMeasureMehods = methods; }
  23. void addStackWidgetPage(int pages);
  24. int getStackedWidgetPages(QList<NodeMatrixInfo *> datas);
  25. bool IsTableEmpty(QStandardItemModel *tableModel);
  26. bool IsQStringListEqual(QStringList tabList, QStringList nextList);
  27. QMap<QString, QSet<QString>> getTabWidgetHeaderLabel(int currentStackWidgetPage);
  28. QTabWidget * createTabWidget(QMap<QString, QSet<QString>> corrElements, int currentPage);
  29. QList<NodeMatrixInfo *> getTableViewContent(QMap<int, QMap<QString, QStandardItemModel *>> pageTabAndCorrTables);
  30. void setTableWidgetContent(QList<NodeMatrixInfo *> datas,
  31. QMap<int, QMap<QString, QStandardItemModel *>> pageTabAndCorrTables);
  32. QStandardItemModel *createModel(QStringList rowHeaderList, QStringList colHeaderList);
  33. private:
  34. QWidget *m_widget;
  35. QPushButton *lastPageBtn;
  36. QPushButton *nextPageBtn;
  37. QPushButton *restoreBtn;
  38. QFrame * m_frame;
  39. QStackedWidget *m_stackWidget;
  40. QVBoxLayout *mainLayout;
  41. QVBoxLayout *frameLayout;
  42. QHBoxLayout *btnLayout;
  43. QTableView *m_tableView;
  44. private:
  45. Ui::ModelViewTable *ui;
  46. private slots:
  47. void switchToNextPage();
  48. void switchToLastPage();
  49. void saveResult();
  50. private:
  51. int stackedWidgetPages;
  52. // QMap<int, QList<QTableWidget* >> pageAndCorrTables;
  53. // QList<QTableWidget* > tmpTables;
  54. QMap<int, QMap<QString, QStandardItemModel *>> pageTabAndCorrTableModels;
  55. QMap<QString, QStandardItemModel *> tabAndCorrTableModel;
  56. QList<NodeMatrixInfo *> datas;
  57. QStringList indexForMeasureMehods;
  58. };
  59. #endif // MODELVIEWTABLE_H