|
@@ -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() { }
|