chengxr 1 年間 前
コミット
0b9afe14cb

+ 2 - 0
QFD/common/QFDIcon.cpp

@@ -13,6 +13,8 @@ QString QFDIcon::iconName(QFDIcon::IconType type)
         return "Expert";
     case Logout:
         return "Logout";
+    case Minus:
+        return "Minus";
     case Project:
         return "Project";
     case User:

+ 1 - 0
QFD/common/QFDIcon.h

@@ -14,6 +14,7 @@ public:
         Detail,
         Expert,
         Logout,
+        Minus,
         Project,
         User,
     };

+ 2 - 0
QFD/resource.qrc

@@ -374,5 +374,7 @@
         <file>resource/i18n/qfluentwidgets_zh.ts</file>
         <file>resource/svg/Logout_black.svg</file>
         <file>resource/svg/Logout_white.svg</file>
+        <file>resource/svg/Minus_black.svg</file>
+        <file>resource/svg/Minus_white.svg</file>
     </qresource>
 </RCC>

+ 1 - 0
QFD/resource/svg/Minus_black.svg

@@ -0,0 +1 @@
+<svg t="1690537583407" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3223" width="16" height="16"><path d="M1024 512a46.545455 46.545455 0 0 1-46.545455 46.545455H46.545455a46.545455 46.545455 0 0 1 0-93.09091h930.90909a46.545455 46.545455 0 0 1 46.545455 46.545455z" p-id="3224" fill="#000000"></path></svg>

+ 1 - 0
QFD/resource/svg/Minus_white.svg

@@ -0,0 +1 @@
+<svg t="1690537583407" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3223" width="16" height="16"><path d="M1024 512a46.545455 46.545455 0 0 1-46.545455 46.545455H46.545455a46.545455 46.545455 0 0 1 0-93.09091h930.90909a46.545455 46.545455 0 0 1 46.545455 46.545455z" p-id="3224" fill="#ffffff"></path></svg>

+ 74 - 27
QFD/widgets/ConfigExpertWidget.cpp

@@ -1,7 +1,10 @@
 #include "ConfigExpertWidget.h"
 
+#include "common/QFDIcon.h"
+
 #include <Common/Icon.h>
 #include <Widgets/Button.h>
+#include <Widgets/SpinBox.h>
 
 #include <QBoxLayout>
 #include <QSplitter>
@@ -38,15 +41,16 @@ void ConfigExpertWidget::initialize()
     m_addedWidgetLayout = new QVBoxLayout(m_addedWidget);
     m_addedWidgetLayout->setSpacing(0);
     m_addedWidgetLayout->setMargin(0);
-    m_addedListHeader       = new QWidget(this);
-    m_addedListHeaderLayout = new QHBoxLayout(m_addedListHeader);
+    m_addedListHeader = new QWidget(this);
     m_addedListHeader->setObjectName("addedListHeader");
-    m_addedListTitleLabel = new QLabel("已添加", this);
+    m_addedListHeader->setFixedHeight(30);
+    m_addedListHeaderLayout = new QHBoxLayout(m_addedListHeader);
+    m_addedListTitleLabel   = new QLabel("已配置权重", this);
     m_addedListTitleLabel->setObjectName("addedListTitleLabel");
     m_addedListTitleLabel->setMargin(5);
     m_saveButton = new QPushButton(NEWFLICON(FluentIcon, SAVE)->icon(), "", this);
     m_saveButton->setObjectName("saveButton");
-    m_saveButton->setFixedSize(QSize(30, 30));
+    m_saveButton->setFixedSize(QSize(28, 28));
     m_saveButton->setToolTip("保存");
     m_addedListWidget = new QListWidget(this);
     m_addedListWidget->setObjectName("addedListWidget");
@@ -58,13 +62,14 @@ void ConfigExpertWidget::initialize()
     m_expWidgetLayout->setMargin(0);
     m_expListHeader = new QWidget(this);
     m_expListHeader->setObjectName("expListHeader");
+    m_expListHeader->setFixedHeight(30);
     m_expListHeaderLayout = new QHBoxLayout(m_expListHeader);
     m_expListTitleLabel   = new QLabel("专家列表", this);
     m_expListTitleLabel->setObjectName("expListTitleLabel");
     m_expListTitleLabel->setMargin(5);
     m_refreshButton = new QPushButton(NEWFLICON(FluentIcon, SYNC)->icon(), "", this);
     m_refreshButton->setObjectName("refreshButton");
-    m_refreshButton->setFixedSize(QSize(30, 30));
+    m_refreshButton->setFixedSize(QSize(28, 28));
     m_refreshButton->setToolTip("刷新");
     m_expListWidget = new QListWidget(this);
     m_expListWidget->setObjectName("expListWidget");
@@ -97,18 +102,20 @@ void ConfigExpertWidget::initLayout()
     m_splitter->setStretchFactor(0, 2);
     m_splitter->setStretchFactor(1, 3);
 
-    setStyleSheet(
-            "#titleLabel {color:#666666; font-size:16px}"
-            "#addedListHeader {background-color:#f8f8f8;border: 1px solid rgba(0, 0, 0, 0.073);}"
-            "#expListHeader {background-color:#f8f8f8;border: 1px solid rgba(0, 0, 0, 0.073);}"
-            "QPushButton {border: 1px solid rgba(0, 0, 0, 0.073);background-color: qlineargradient(x1: 0, y1: 0, x2: "
-            "0, y2: 1,stop: 0 #f6f7fa, stop: 1 #dadbde);height:15px;width:30px;}"
-            "QPushButton::hover {border: 0;}"
-            "QPushButton::pressed {background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dadbde, "
-            "stop: 1 #f6f7fa);}"
-            "QListWidget {border: 1px solid rgba(0, 0, 0, 0.073);}"
-            "QListView::item {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #ffffff, stop: 0.9 "
-            "#ffffff,stop: 1 #eeeeee);height:44;}");
+    setStyleSheet("#titleLabel {color:#333333; font-size:16px}"
+                  "#addedListHeader {background-color:#f8f8f8;border: 1px solid rgba(0, 0, 0, 0.073);}"
+                  "#expListHeader {background-color:#f8f8f8;border: 1px solid rgba(0, 0, 0, 0.073);}"
+                  "QPushButton {border: 0;background-color: qlineargradient(x1: 0, y1: 0, x2: "
+                  "0, y2: 1,stop: 0 #f8f8f8, stop: 1 #f8f8f8);}"
+                  "QPushButton::hover {border: 1px solid rgba(0, 0, 0, 0.073);}"
+                  "QPushButton::pressed {background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dadbde, "
+                  "stop: 1 #f6f7fa);}"
+                  "QListWidget {border: 1px solid rgba(0, 0, 0, 0.073);}"
+                  "QListView::item {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #ffffff, stop: 0.9 "
+                  "#ffffff,stop: 1 #eeeeee);height:44;}"
+                  "QDoubleSpinBox {border: 1px solid rgba(0, 0, 0, 0.173);}"
+                  "#addedListTitleLabel {font:bold;}"
+                  "#expListTitleLabel {font:bold;}");
 }
 
 void ConfigExpertWidget::connectSignalsAndSlots() { }
@@ -117,26 +124,66 @@ void ConfigExpertWidget::refreshAddedList()
 {
     m_addedListWidget->clear();
 
-    for (int i = 1; i <= 5; i++) {
+    for (int i = 1; i <= 3; i++) {
         QListWidgetItem *item = new QListWidgetItem;
-        m_addedListWidget->addItem(item);
+        QWidget *w            = new QWidget();
+        QHBoxLayout *hBox     = new QHBoxLayout(w);
+        QLabel *idx           = new QLabel(QString::number(i));
+        idx->setFixedWidth(25);
+        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(20, 20));
+        button->setIconSize(QSize(10, 10));
 
-        QWidget *w = new QWidget();
+        hBox->setSpacing(0);
+        hBox->setMargin(10);
+        hBox->addWidget(idx);
+        hBox->addWidget(name);
+        hBox->addSpacing(20);
+        hBox->addWidget(spin, Qt::AlignCenter);
+        hBox->addStretch();
+        hBox->addWidget(button, Qt::AlignRight);
+
+        m_addedListWidget->addItem(item);
         m_addedListWidget->setItemWidget(item, w);
 
-        QHBoxLayout *hBox = new QHBoxLayout(w);
+        idx->setStyleSheet("font-size:14px; color:#aaaaaa");
+    }
+}
+
+void ConfigExpertWidget::refreshExpList()
+{
+    m_expListWidget->clear();
+
+    for (int i = 1; i <= 50; i++) {
+        QListWidgetItem *item = new QListWidgetItem;
+        QWidget *w            = new QWidget();
+        QHBoxLayout *hBox     = new QHBoxLayout(w);
+        QLabel *idx           = new QLabel(QString::number(i));
+        idx->setFixedWidth(25);
+        QLabel *name        = new QLabel(QString("专家%1").arg(i));
+        QPushButton *button = new QPushButton(NEWFLICON(FluentIcon, ADD)->icon(), "", w);
+        button->setFixedSize(QSize(20, 20));
+        button->setIconSize(QSize(10, 10));
+
+        if (i % 2 == 0 && i <= 6) {
+            button->setHidden(true);
+        }
+
         hBox->setSpacing(0);
         hBox->setMargin(10);
-
-        QLabel *idx = new QLabel(QString::number(i));
-        idx->setFixedWidth(20);
         hBox->addWidget(idx);
-        QLabel *name = new QLabel(QString("专家%1").arg(i));
         hBox->addWidget(name);
         hBox->addStretch();
+        hBox->addWidget(button, Qt::AlignRight);
+
+        m_expListWidget->addItem(item);
+        m_expListWidget->setItemWidget(item, w);
 
         idx->setStyleSheet("font-size:14px; color:#aaaaaa");
     }
 }
-
-void ConfigExpertWidget::refreshExpList() { }