#ifndef MATRIXTABLEWIDGET_H #define MATRIXTABLEWIDGET_H #include #include #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 getSource() const; bool isDataReady() const; void paintMatrixTable(QList 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 matrixRows; QList matrixCols; QList 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