123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #include "SchemeOptionWidget.h"
- #include "CreateSchemeWidget.h"
- #include <Widgets/Button.h>
- #include <Common/Icon.h>
- #include <QLabel>
- #include <QBoxLayout>
- #include <QListWidget>
- #include <QButtonGroup>
- SchemeOptionWidget::SchemeOptionWidget(QWidget *parent) : QWidget(parent)
- {
- initialize();
- initLayout();
- connectSignalsAndSlots();
- }
- void SchemeOptionWidget::initialize()
- {
- m_vBoxLayout = new QVBoxLayout(this);
- m_addButton = new PushButton("新增方案", NEWFLICON(FluentIcon, ADD), this);
- m_removeButton = new PushButton("删除方案", NEWFLICON(FluentIcon, DELETE), this);
- m_normalLabel = new QLabel("归一化公式", this);
- m_normalLayout = new QVBoxLayout();
- m_minButton = new RadioButton("最小值");
- m_minButton->setChecked(true);
- m_maxButton = new RadioButton("最大值");
- m_zscoreButton = new RadioButton("Z-Score法");
- QButtonGroup *normalGroup = new QButtonGroup(this);
- normalGroup->addButton(m_minButton);
- normalGroup->addButton(m_maxButton);
- normalGroup->addButton(m_zscoreButton);
- m_calcLabel = new QLabel("计算方法", this);
- m_calcLayout = new QVBoxLayout();
- m_pairButton = new RadioButton("集对分析法");
- m_pairButton->setChecked(true);
- m_averageButton = new RadioButton("平均值法");
- QButtonGroup *calcGroup = new QButtonGroup(this);
- calcGroup->addButton(m_pairButton);
- calcGroup->addButton(m_averageButton);
- m_buttonLayout = new QHBoxLayout();
- m_calcButton = new PushButton("计算", this);
- m_saveButton = new PushButton("保存", this);
- m_schemeLabel = new QLabel("方案排行榜", this);
- m_listWidget = new QListWidget(this);
- m_listWidget->setFixedHeight(200);
- m_addSchemeWidget = new CreateSchemeWidget(this);
- setStyleSheet("QListWidget {border: 1px solid rgba(0, 0, 0, 0.073);background: rgb(255, 255, "
- "255);alternate-background-color: rgb(244, 244, 255);}");
- }
- void SchemeOptionWidget::initLayout()
- {
- m_vBoxLayout->addWidget(m_addButton);
- m_vBoxLayout->addWidget(m_removeButton);
- m_vBoxLayout->addSpacing(20);
- m_vBoxLayout->addWidget(m_normalLabel);
- m_vBoxLayout->addLayout(m_normalLayout);
- m_normalLayout->setContentsMargins(20, 0, 0, 0);
- m_normalLayout->addWidget(m_minButton);
- m_normalLayout->addWidget(m_maxButton);
- m_normalLayout->addWidget(m_zscoreButton);
- m_vBoxLayout->addSpacing(20);
- m_vBoxLayout->addWidget(m_calcLabel);
- m_vBoxLayout->addLayout(m_calcLayout);
- m_calcLayout->setContentsMargins(20, 0, 0, 0);
- m_calcLayout->addWidget(m_pairButton);
- m_calcLayout->addWidget(m_averageButton);
- m_vBoxLayout->addSpacing(20);
- m_vBoxLayout->addLayout(m_buttonLayout);
- m_buttonLayout->addStretch();
- m_buttonLayout->addWidget(m_calcButton);
- m_buttonLayout->addSpacing(30);
- m_buttonLayout->addWidget(m_saveButton);
- m_buttonLayout->addStretch();
- m_vBoxLayout->addSpacing(20);
- m_vBoxLayout->addStretch();
- m_vBoxLayout->addWidget(m_schemeLabel);
- m_vBoxLayout->addWidget(m_listWidget);
- }
- void SchemeOptionWidget::connectSignalsAndSlots()
- {
- connect(m_addButton, &PushButton::clicked, this, &SchemeOptionWidget::slotAddSchemeClicked);
- connect(m_removeButton, &PushButton::clicked, this, &SchemeOptionWidget::slotRemoveSchemeClicked);
- }
- void SchemeOptionWidget::slotAddSchemeClicked()
- {
- if (m_addSchemeWidget->isVisible() == false) {
- m_addSchemeWidget->clearInputs();
- m_addSchemeWidget->show();
- }
- }
- void SchemeOptionWidget::slotRemoveSchemeClicked() { }
|