#pragma once //////////////////////////////////////////////////////////////////// // 特别说明:由于进度限制,并且为了测试AI编码,对于多层的对话框设置,功能相对比 // 较单一,而且有对标软件的效果,所以采用了AI直接编码模式,基本没有做大的改动。 // 效果功能优先,暂不予iFramework框架进行集成。 // 涉及类库及文件:iLayerColorBand.h/cpp // iLayerTableModel.h/cpp // iLayerTableView.h/cpp // iLayerWx.h/cpp // 创建日期:2026-01-08 // 作者:AI大模型 // 整合者:wangzg // 后附:具体交互见 iLayerWx.h //////////////////////////////////////////////////////////////////// #include #include #include "mGuiAnal_global.h" struct LayerData { QString layerName; double thickness; // unit: meter double ratio; // percentage QString remark; QColor color; LayerData() : thickness(10.0), ratio(0.0) {} LayerData(const QString& name, double thick, const QColor& col) : layerName(name), thickness(thick), ratio(0.0), color(col) {} }; class M_GUI_ANAL_EXPORT iLayerTableModel : public QAbstractTableModel { Q_OBJECT public: iLayerTableModel(QObject *parent = 0); ~iLayerTableModel(); // Basic override functions int rowCount(const QModelIndex &parent = QModelIndex()) const ; int columnCount(const QModelIndex &parent = QModelIndex()) const ; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const ; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); Qt::ItemFlags flags(const QModelIndex &index) const; // Custom functions void addLayer(const QString& defaultName = "", double thickness = 10.0); void insertLayer(int row, const QString& defaultName = "", double thickness = 10.0); void removeLayer(int row); void setRowCount(int count); // Update ratios for all rows void updateRatios(); // Get total thickness double getTotalThickness() const; // Get/Set layer data QList getLayerData() const; void setLayerData(const QList& data); // Get/Set color for specific layer QColor getLayerColor(int row) const; void setLayerColor(int row, const QColor& color); // Get default color QColor getDefaultColor(int index) const; static QColor defaultColorOf(int index); // Modify layer thickness and update ratio bool setOneRowThickness(int row, double thickness, double newRatio); signals: // 添加这个信号,用于通知厚度或名称发生变化 void layerDataChanged(); private: void initDefaultLayers(); private: QList m_layers; };