Pārlūkot izejas kodu

添加配置专家页面

chengxr 1 gadu atpakaļ
vecāks
revīzija
0ffd7c085b

+ 2 - 1
QFD/CCanvas/CTextItem.cpp

@@ -56,7 +56,8 @@ void CTextItem::endEditing()
         m_textChanged = false;
     }
 
-    // 没找到取消文字选中状态的方法, 暂且用这个吧, 这回触发数据库保存操作
+    // 没找到取消文字选中状态的方法, 暂且用这个吧
+    // 因为这相当于编辑了文字, 会触发数据库保存操作
     setPlainText(toPlainText());
 }
 

+ 11 - 1
QFD/view/ProjectView.cpp

@@ -64,8 +64,11 @@ void ProjectView::initWidgets()
     m_title->setText(m_proj->projectName);
     QFont ft("Microsoft YaHei", 14);
     m_title->setFont(ft);
+    m_export = new PushButton("导出", this);
+    m_export->setToolTip("导出资源包");
     m_close = new PushButton("关闭", this);
-    m_tree  = new TreeWidget(this);
+    m_close->setToolTip("关闭项目");
+    m_tree = new TreeWidget(this);
 
     // 根据评估类型添加列表条目
     QList<ProjectManager::EvalType> types = ProjectManager::evalTypeList(*m_proj);
@@ -115,6 +118,7 @@ void ProjectView::initLayout()
 
     m_headerLayout->addWidget(m_title);
     m_headerLayout->addStretch();
+    m_headerLayout->addWidget(m_export);
     m_headerLayout->addWidget(m_close);
     m_headerLayout->addSpacing(10);
 
@@ -125,6 +129,7 @@ void ProjectView::initLayout()
 
 void ProjectView::connectSigalsAndSlots()
 {
+    connect(m_export, &PushButton::clicked, this, &ProjectView::exportClicked);
     connect(m_close, &PushButton::clicked, this, &ProjectView::sigClose);
     connect(m_tree, &TreeWidget::itemClicked, this, &ProjectView::itemClicked);
 }
@@ -151,3 +156,8 @@ void ProjectView::itemClicked(QTreeWidgetItem *item, int column)
 
     showEvalWidget(eval, taskIndex);
 }
+
+void ProjectView::exportClicked()
+{
+    qDebug() << __FUNCTION__ << __LINE__ << endl;
+}

+ 2 - 0
QFD/view/ProjectView.h

@@ -43,6 +43,7 @@ private:
 
 private slots:
     void itemClicked(QTreeWidgetItem *item, int column);
+    void exportClicked();
 
 private:
     ProjectInfo *m_proj = nullptr;
@@ -52,6 +53,7 @@ private:
     QHBoxLayout *m_contentLayout = nullptr;
 
     QLabel *m_title      = nullptr;
+    PushButton *m_export = nullptr;
     PushButton *m_close  = nullptr;
     TreeWidget *m_tree   = nullptr;
     QWidget *m_seperator = nullptr;

+ 14 - 6
QFD/widgets/ConfigExpertWidget.cpp

@@ -136,15 +136,22 @@ void ConfigExpertWidget::refreshAddedList()
         QHBoxLayout *hBox     = new QHBoxLayout(w);
         QLabel *idx           = new QLabel(QString::number(i));
         idx->setFixedWidth(25);
-        QLabel *name         = new QLabel(QString("专家%1").arg(i * 2));
+        QLabel *name = new QLabel(QString("专家%1").arg(i * 2));
+
         QDoubleSpinBox *spin = new QDoubleSpinBox(w);
         spin->setRange(0, 1);
         spin->setSingleStep(0.01);
         spin->setFixedSize(QSize(60, 25));
-        QPushButton *button = new QPushButton(NEWFLICON(QFDIcon, Minus)->icon(), "", w);
-        button->setFixedSize(QSize(25, 25));
-        button->setIconSize(QSize(10, 10));
-        button->setToolTip("移除");
+
+        QPushButton *import = new QPushButton(NEWFLICON(FluentIcon, DOWNLOAD)->icon(), "", w);
+        import->setFixedSize(QSize(25, 25));
+        import->setIconSize(QSize(15, 15));
+        import->setToolTip("导入专家数据");
+
+        QPushButton *remove = new QPushButton(NEWFLICON(QFDIcon, Minus)->icon(), "", w);
+        remove->setFixedSize(QSize(25, 25));
+        remove->setIconSize(QSize(10, 10));
+        remove->setToolTip("移除");
 
         hBox->setSpacing(0);
         hBox->setMargin(10);
@@ -153,7 +160,8 @@ void ConfigExpertWidget::refreshAddedList()
         hBox->addSpacing(20);
         hBox->addWidget(spin, Qt::AlignCenter);
         hBox->addStretch();
-        hBox->addWidget(button, Qt::AlignRight);
+        hBox->addWidget(import);
+        hBox->addWidget(remove, Qt::AlignRight);
 
         m_addedListWidget->addItem(item);
         m_addedListWidget->setItemWidget(item, w);

+ 10 - 0
QFD/widgets/ConfigExpertWidget.h

@@ -13,6 +13,16 @@ class QSplitter;
 class QPushButton;
 class QListWidget;
 
+class ConfigListItemWidget : public QWidget
+{
+    Q_OBJECT
+};
+
+class ExpertListItemWidget : public QWidget
+{
+    Q_OBJECT
+};
+
 class ConfigExpertWidget : public QWidget
 {
     Q_OBJECT

+ 4 - 0
QFD/widgets/DataCollectionWidget.cpp

@@ -1,12 +1,16 @@
 #include "DataCollectionWidget.h"
 
 #include "DataTableWidget.h"
+#include "ConfigExpertWidget.h"
 
 #include <QTabWidget>
+#include <QBoxLayout>
 
 DataCollectionWidget::DataCollectionWidget(ProjectInfo *proj, QWidget *parent) : EvalWidget(proj, parent)
 {
     setTitle("评估数据采集");
+    m_configExpert = new ConfigExpertWidget(this);
+    m_contentLayout->addWidget(m_configExpert);
 }
 
 void DataCollectionWidget::setType(int type)

+ 5 - 0
QFD/widgets/DataCollectionWidget.h

@@ -3,6 +3,8 @@
 
 #include "EvalWidget.h"
 
+class ConfigExpertWidget;
+
 class PushButton;
 
 class QTabWidget;
@@ -24,6 +26,9 @@ private:
     void setupTabWidget();
 
 signals:
+
+private:
+    ConfigExpertWidget *m_configExpert = nullptr;
 };
 
 #endif  // DATACOLLECTIONWIDGET_H

+ 2 - 0
QFD/widgets/DataTableWidget.cpp

@@ -136,6 +136,7 @@ void DataTableWidget::updateCurrentTable()
     for (int i = 0; i < hList.count(); i++) {
         CNodeData node      = hList[i];
         QStandardItem *item = new QStandardItem(node.name);
+        item->setToolTip(node.remark);
         model->setHorizontalHeaderItem(i, item);
     }
 
@@ -147,6 +148,7 @@ void DataTableWidget::updateCurrentTable()
     for (int i = 0; i < vList.count(); i++) {
         CNodeData node      = vList[i];
         QStandardItem *item = new QStandardItem(QString("  %1  ").arg(node.name));
+        item->setToolTip(node.remark);
         model->setVerticalHeaderItem(i, item);
         table->setRowHeight(i, 35);
     }

+ 1 - 1
QFD/widgets/EvalWidget.cpp

@@ -66,7 +66,7 @@ void EvalWidget::initWidgets()
 void EvalWidget::initLayout()
 {
     m_layout        = new QVBoxLayout(this);
-    m_contentLayout = new QVBoxLayout();
+    m_contentLayout = new QHBoxLayout();
 
     m_layout->addWidget(m_title);
     m_layout->addWidget(m_seperator);

+ 2 - 1
QFD/widgets/EvalWidget.h

@@ -8,6 +8,7 @@
 class ProjectInfo;
 
 class QVBoxLayout;
+class QHBoxLayout;
 class QLabel;
 class QTabWidget;
 
@@ -39,7 +40,7 @@ protected:
     QTabWidget *m_tab = nullptr;
 
     QVBoxLayout *m_layout        = nullptr;
-    QVBoxLayout *m_contentLayout = nullptr;
+    QHBoxLayout *m_contentLayout = nullptr;
 
     QLabel *m_title      = nullptr;
     QWidget *m_seperator = nullptr;