DataTableWidget.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef DATATABLEWIDGET_H
  2. #define DATATABLEWIDGET_H
  3. #include <QWidget>
  4. #include "SchemePlanManager.h"
  5. #include <CNode.h>
  6. #include <dbService/ClassSet.h>
  7. #include <QStandardItemModel>
  8. class DataTableComboDelegate;
  9. class CMind;
  10. class ProjectInfo;
  11. class PushButton;
  12. class QLabel;
  13. class QTabWidget;
  14. class QVBoxLayout;
  15. class QHBoxLayout;
  16. class DataTableItemModel : public QStandardItemModel
  17. {
  18. public:
  19. explicit DataTableItemModel(QObject *parent = nullptr);
  20. QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
  21. };
  22. /**
  23. * @brief The DataTableWidget class
  24. * 数据表, 整体上是包含多个 QTableView 的 QTabWidget
  25. * 显示以下数据:
  26. * 能力重要度评估, 技术措施重要度, 方案优选评估: 权重分析数据和评估数据
  27. * 综合效能评估: 权重分析数据
  28. * 综合效能评估-物元分析法: 评估数据
  29. */
  30. class DataTableWidget : public QWidget
  31. {
  32. Q_OBJECT
  33. public:
  34. explicit DataTableWidget(SchemePlanManager::SchemeProcessInfo process, QWidget *parent = nullptr);
  35. SchemePlanManager::SchemeProcessInfo process() const;
  36. void initWidget();
  37. void initLayout();
  38. void connectSignalsAndSlots();
  39. void setupModels();
  40. void setupTabWidget();
  41. int currentPage() const;
  42. void setCurrentPage(int p);
  43. void updateCurrentTable();
  44. void setSchemeList(const QList<SchemaEval *> &list);
  45. void addScheme(SchemaEval *scheme);
  46. QTabWidget *tabWidget() const;
  47. CMind *mind1() const;
  48. CMind *mind2() const;
  49. void setNodeMatrixData(QList<NodeMatrixInfo *> data, bool isExpertData);
  50. signals:
  51. void sigMeasureDataEdited(NodeMatrixInfo *info);
  52. private:
  53. void updateModel(DataTableItemModel *model, QList<CNodeData> &hHeaders, QList<CNodeData> &vHeaders, int hStart = 0,
  54. int vStart = 0);
  55. public slots:
  56. void slotPrevious();
  57. void slotNext();
  58. void slotTabCurrentChanged(int c);
  59. void itemChanged(QStandardItem *item);
  60. private:
  61. SchemePlanManager::SchemeProcessInfo m_process;
  62. QMap<int, QList<DataTableItemModel *>> m_models;
  63. int m_currentPage = 0;
  64. CMind *m_mind1 = nullptr;
  65. CMind *m_mind2 = nullptr;
  66. QTabWidget *m_dataTab = nullptr;
  67. QLabel *m_pageLab = nullptr; // 共4页, 当前第2页
  68. PushButton *m_previous = nullptr; // 上一级指标
  69. PushButton *m_next = nullptr; // 下一级指标
  70. QVBoxLayout *m_layout = nullptr;
  71. QHBoxLayout *m_pageLayout = nullptr;
  72. bool m_isSettingTable = false;
  73. DataTableComboDelegate *m_comboDelegate = nullptr;
  74. QList<NodeMatrixInfo *> m_data;
  75. QString m_uuidStr;
  76. bool m_isFillingData = false;
  77. int m_schemeStartIndex = -1; // 方案数据开始列
  78. QList<SchemaEval *> m_schemeList;
  79. };
  80. #endif // DATATABLEWIDGET_H