123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #include "EvaluateOptionWidget.h"
- #include "QFDIcon.h"
- #include <Widgets/LineEdit.h>
- #include <Widgets/Button.h>
- #include <QLabel>
- #include <QBoxLayout>
- #include <QListWidget>
- #include <QButtonGroup>
- EvaluateOptionWidget::EvaluateOptionWidget(QWidget *parent) : QWidget(parent)
- {
- initialize();
- initLayout();
- connectSignalsAndSlots();
- refreshExpertList();
- }
- void EvaluateOptionWidget::initialize()
- {
- m_vBoxLayout = new QVBoxLayout(this);
- m_expDataLabel = new QLabel("专家数据", this);
- m_listWidget = new QListWidget(this);
- m_listWidget->setFixedHeight(250);
- m_radioLayout = new QVBoxLayout();
- m_radioButton1 = new RadioButton("算术平均", this);
- m_radioButton1->setChecked(true);
- m_radioButton2 = new RadioButton("几何平均", this);
- QButtonGroup *group = new QButtonGroup(this);
- group->addButton(m_radioButton1);
- group->addButton(m_radioButton2);
- m_expInfoLabel = new QLabel("专家介绍", this);
- m_expInfoEdit = new TextEdit(this);
- m_expInfoEdit->setReadOnly(true);
- m_expInfoEdit->setText("awdsfawdvasdvasdvasdv");
- m_expInfoEdit->setFixedHeight(200);
- m_buttonLayout = new QHBoxLayout();
- m_exportButton = new PushButton("导出xlsx文件", NEWFLICON(FluentIcon, SHARE), this);
- setStyleSheet("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;}"
- "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);}");
- }
- void EvaluateOptionWidget::initLayout()
- {
- m_vBoxLayout->addWidget(m_expDataLabel);
- m_vBoxLayout->addWidget(m_listWidget);
- m_vBoxLayout->addSpacing(30);
- m_vBoxLayout->addLayout(m_radioLayout);
- m_radioLayout->addWidget(m_radioButton1);
- m_radioLayout->addWidget(m_radioButton2);
- m_vBoxLayout->addSpacing(30);
- m_vBoxLayout->addLayout(m_buttonLayout);
- m_buttonLayout->addWidget(m_exportButton, Qt::AlignRight);
- m_vBoxLayout->addStretch();
- m_vBoxLayout->addWidget(m_expInfoLabel);
- m_vBoxLayout->addWidget(m_expInfoEdit);
- }
- void EvaluateOptionWidget::connectSignalsAndSlots() { }
- void EvaluateOptionWidget::refreshExpertList()
- {
- m_listWidget->clear();
- for (int i = 1; i <= 50; i++) {
- QListWidgetItem *item = new QListWidgetItem;
- item->setSizeHint(QSize(100, 40));
- m_listWidget->addItem(item);
- QWidget *w = new QWidget();
- m_listWidget->setItemWidget(item, w);
- QHBoxLayout *hBox = new QHBoxLayout(w);
- hBox->setMargin(10);
- QLabel *avatar = new QLabel(w);
- avatar->setPixmap(NEWFLICON(QFDIcon, Expert)->icon().pixmap(16, 16));
- hBox->addWidget(avatar);
- hBox->addSpacing(10);
- QLabel *name = new QLabel(QString("专家%1").arg(i));
- hBox->addWidget(name);
- hBox->addStretch();
- QPushButton *button = new QPushButton(NEWFLICON(FluentIcon, DOWNLOAD)->icon(), "", w);
- button->setFixedSize(QSize(25, 25));
- button->setIconSize(QSize(15, 15));
- button->setToolTip("导入专家数据");
- hBox->addWidget(button);
- if (i % 2 == 0 && i < 6) {
- button->setIcon(NEWFLICON(FluentIcon, COMPLETED)->icon());
- button->setEnabled(false);
- button->setToolTip("已导入");
- }
- }
- }
|