MatterElementConfigWidget.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef MATTERELEMENTCONFIGWIDGET_H
  2. #define MATTERELEMENTCONFIGWIDGET_H
  3. #include <QLineEdit>
  4. #include <QStandardItemModel>
  5. #include <QWidget>
  6. class CMind;
  7. struct MEDomain
  8. {
  9. QString name;
  10. QVector<double> leftValues; // 与阈值相关 size == m_domainLevel+1
  11. QVector<double> rightValues; // 与阈值相关 size == m_domainLevel+1
  12. QVector<bool> leftCloses;
  13. QVector<bool> rightCloses;
  14. };
  15. struct MEConfigItem
  16. {
  17. QString parentName;
  18. QVector<MEDomain> childs;
  19. };
  20. class MatterElementItemRangeDelegate;
  21. namespace Ui {
  22. class MatterElementConfigWidget;
  23. }
  24. class MatterElementConfigWidget : public QWidget
  25. {
  26. Q_OBJECT
  27. public:
  28. explicit MatterElementConfigWidget(CMind *mind, int domainLevel, QWidget *parent = nullptr);
  29. ~MatterElementConfigWidget();
  30. QList<MEConfigItem> getAllConfigItems() const;
  31. QStringList getDomainLevels() const;
  32. QVector<QVector<double>> getScaleValues() const;
  33. private:
  34. void initScaleDivisionTable(); // 标度划分表
  35. void initDomainLevelLayout();
  36. void initConfigItems();
  37. void initDomainTable(); // 经典域、节域配置
  38. private slots:
  39. void onLevelSaveBtnClick();
  40. void onScaleValueUpdate();
  41. void onClearBtnClick();
  42. void onSaveBtnClick();
  43. void onTableItemChanged(QStandardItem *item);
  44. private:
  45. Ui::MatterElementConfigWidget *ui;
  46. QStandardItemModel *m_scaleDivisionmodel = nullptr;
  47. QList<QLineEdit *> m_levelEdits;
  48. QList<QStandardItemModel *> m_domainModels; // 配置域的表格集合
  49. MatterElementItemRangeDelegate *m_meRangeDelegate = nullptr;
  50. QList<MEConfigItem> m_allConfigItems;
  51. int m_domainLevel;
  52. CMind *m_mind = nullptr;
  53. };
  54. #endif // MATTERELEMENTCONFIGWIDGET_H