123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #ifndef MATRIXTABLEWIDGET_H
- #define MATRIXTABLEWIDGET_H
- #include <QStandardItemModel>
- #include <QTableView>
- #include "dbService/ClassSet.h"
- struct MatrixDataSource
- {
- QString node; //节点
- QString abscissa; //横坐标
- QString ordinate; //纵坐标
- QString nodeValue; //节点值
- int row = -1;
- int col = -1;
- bool changed = false;
- };
- class MatrixTableWidget : public QTableView
- {
- Q_OBJECT
- public:
- explicit MatrixTableWidget(bool diagonalOne = true, QWidget *parent = nullptr);
- ~MatrixTableWidget();
- void addRowNode(QString node, QString name, QString remark);
- void addColNode(QString node, QString name, QString remark);
- QList<MatrixDataSource> getSource() const;
- bool isDataReady() const;
- void paintMatrixTable(QList<NodeMatrixInfo *> nodeValueInfoList);
- void setCurrentPage(int page);
- void setTableIndexAndTableMsg(int index, int engineerId, int expertId, QString tableMsg);
- void setMsgName(QString msgName);
- signals:
- void dataReady(bool status);
- void autoSave();
- void returnModel(QStandardItemModel *item);
- void returnModelName(QString itemName);
- private slots:
- void nodeValueChanged(QStandardItem *item);
- void itemClicked(const QModelIndex &index);
- private:
- /**
- * @brief 遍历表格是否为空
- */
- void pollCellsData();
- void editItemData(const QModelIndex &index, const QString &val);
- struct MatrixNode
- {
- MatrixNode(QString no, QString na, QString re) : node(no), name(na), remark(re) { }
- QString node;
- QString name;
- QString remark;
- };
- bool paintDone = false;
- QList<MatrixNode> matrixRows;
- QList<MatrixNode> matrixCols;
- QList<MatrixDataSource> dataSource;
- QStandardItemModel *model;
- bool diagonalIsOne;
- int currentPage;
- int m_tableIndex = 0;
- int m_engineerId; // 工程id
- int m_expertId; // 专家id
- QString m_engineer_name;
- QString m_expert_name;
- QString m_table_msg;
- QString m_msg_name;
- };
- #endif // MATRIXTABLEWIDGET_H
|