chengxr 1 year ago
parent
commit
c6d9a67b00

+ 1 - 1
QFD/widgets/DataCollectionWidget.cpp

@@ -16,7 +16,7 @@ void DataCollectionWidget::setType(int type)
 void DataCollectionWidget::setupTabWidget()
 {
     m_tab->clear();
-    for (int i : m_indexList) {
+    for (int i : indexList()) {
         QWidget *m                  = new QWidget(this);
         ProjectManager::IndexType t = (ProjectManager::IndexType)i;
         QString s                   = ProjectManager::nameOfIndexType(t);

+ 1 - 1
QFD/widgets/DataProcessingWidget.cpp

@@ -16,7 +16,7 @@ void DataProcessingWidget::setType(int type)
 void DataProcessingWidget::setupTabWidget()
 {
     m_tab->clear();
-    for (int i : m_indexList) {
+    for (int i : indexList()) {
         QWidget *m                  = new QWidget(this);
         ProjectManager::IndexType t = (ProjectManager::IndexType)i;
         QString s                   = ProjectManager::nameOfIndexType(t);

+ 1 - 1
QFD/widgets/EvalSchemeWidget2.cpp

@@ -18,7 +18,7 @@ void EvalSchemeWidget2::setType(int type)
 void EvalSchemeWidget2::setupTabWidget()
 {
     m_tab->clear();
-    for (int i : m_indexList) {
+    for (int i : indexList()) {
         CSchemeView *m              = new CSchemeView(this);
         ProjectManager::IndexType t = (ProjectManager::IndexType)i;
         QString s                   = ProjectManager::nameOfIndexType(t);

+ 7 - 3
QFD/widgets/EvalWidget.cpp

@@ -31,9 +31,13 @@ int EvalWidget::type() const
 
 void EvalWidget::setType(int type)
 {
-    m_type                      = type;
-    ProjectManager::EvalTypes t = (ProjectManager::EvalTypes)type;
-    m_indexList                 = ProjectManager::indexListOfEvalTypes(t);
+    m_type = type;
+}
+
+QList<ProjectManager::IndexType> EvalWidget::indexList() const
+{
+    ProjectManager::EvalTypes t = (ProjectManager::EvalTypes)m_type;
+    return ProjectManager::indexListOfEvalTypes(t);
 }
 
 void EvalWidget::setTitle(const QString title)

+ 2 - 2
QFD/widgets/EvalWidget.h

@@ -23,6 +23,8 @@ public:
     int type() const;
     virtual void setType(int type);
 
+    QList<ProjectManager::IndexType> indexList() const;
+
     void setTitle(const QString title);
 
     void initWidgets();
@@ -33,8 +35,6 @@ protected:
     ProjectInfo *m_proj = nullptr;
     int m_type          = 0;  // 评估类型
 
-    QList<ProjectManager::IndexType> m_indexList;
-
     QTabWidget *m_tab = nullptr;
 
     QVBoxLayout *m_layout        = nullptr;

+ 2 - 2
QFD/widgets/IndexSystemWidget.cpp

@@ -54,7 +54,7 @@ void IndexSystemWidget::contextMenuEvent(QContextMenuEvent *event)
 void IndexSystemWidget::setupTabWidget()
 {
     m_tab->clear();
-    for (int i : m_indexList) {
+    for (int i : indexList()) {
         CMindView *m                = new CMindView(this);
         ProjectManager::IndexType t = (ProjectManager::IndexType)i;
         QString s                   = ProjectManager::nameOfIndexType(t);
@@ -108,7 +108,7 @@ void IndexSystemWidget::slotClearAllNodes()
 
 void IndexSystemWidget::slotCreateRootNode()
 {
-    int t       = m_indexList[m_tab->currentIndex()];
+    int t       = indexList()[m_tab->currentIndex()];
     CNodeData n = CNodeData(m_proj->id, t, 0);
     n.name      = m_proj->projectName;
     addNode(n);