|
@@ -47,11 +47,16 @@ EvalSchemeWidget::EvalSchemeWidget(ProjectInfo *proj, int type, QWidget *parent)
|
|
|
{
|
|
|
setTitle("评估方案规划");
|
|
|
|
|
|
+ m_schemes["指标体系"] = { Index | Process | Output, Alg1 };
|
|
|
+ m_schemes["收集数据"] = { Collect | Process | Output, Alg1 };
|
|
|
+ m_schemes["指标体系和收集数据"] = { Index | Collect | Process | Output, Alg1 };
|
|
|
+
|
|
|
initWidgets();
|
|
|
initLayout();
|
|
|
connectSignalsAndSlots();
|
|
|
|
|
|
- testData();
|
|
|
+ loadScheme(m_schemes.keys().first());
|
|
|
+ updateButtonState();
|
|
|
}
|
|
|
|
|
|
void EvalSchemeWidget::initWidgets()
|
|
@@ -62,32 +67,18 @@ void EvalSchemeWidget::initWidgets()
|
|
|
m_algBtn = new PushButton("数据处理", this);
|
|
|
m_clear = new PushButton("清空");
|
|
|
|
|
|
- // 按照方案枚举值添加按钮
|
|
|
- // QMetaEnum sch = QMetaEnum::fromType<Scheme>();
|
|
|
- // for (int i = 0; i < sch.keyCount(); i++) {
|
|
|
- // Scheme s = Scheme(sch.value(i));
|
|
|
- // PushButton *btn = new PushButton(nameOfScheme(s), this);
|
|
|
- // btn->setMinimumWidth(80);
|
|
|
- // m_buttonLayout->addWidget(btn);
|
|
|
- // connect(btn, &PushButton::clicked, [this, s, btn]() { slotSelectScheme(s, btn); });
|
|
|
- // }
|
|
|
- // m_buttonLayout->setSpacing(15);
|
|
|
- // m_buttonLayout->addStretch();
|
|
|
-
|
|
|
m_schemeView = new CSchemeView(this);
|
|
|
m_schemeSep = new QWidget(this);
|
|
|
m_schemeSep->setFixedWidth(1);
|
|
|
m_description = new QLabel("description", this);
|
|
|
m_description->setFixedWidth(150);
|
|
|
|
|
|
- QMap<QString, SchemeAndAlg> schemes;
|
|
|
- schemes["指标体系"] = { Index | Process | Output, Alg1 };
|
|
|
- schemes["收集数据"] = { Collect | Process | Output, Alg1 };
|
|
|
- schemes["指标体系和收集数据"] = { Index | Collect | Process | Output, Alg1 };
|
|
|
- m_schemeMenu = new RoundMenu("scheme", this);
|
|
|
- m_schemeMenu->addAction(new QAction("方案一"));
|
|
|
- m_schemeMenu->addAction(new QAction("方案二"));
|
|
|
- m_schemeMenu->addAction(new QAction("方案三"));
|
|
|
+ m_schemeMenu = new RoundMenu("scheme", this);
|
|
|
+ for (QString key : m_schemes.keys()) {
|
|
|
+ QAction *act = new QAction(key);
|
|
|
+ m_schemeMenu->addAction(act);
|
|
|
+ connect(act, &QAction::triggered, [this, act]() { loadScheme(act->text()); });
|
|
|
+ }
|
|
|
|
|
|
// 按照算法枚举值添加算法选项
|
|
|
m_algMenu = new RoundMenu("alg", this);
|
|
@@ -135,7 +126,7 @@ void EvalSchemeWidget::connectSignalsAndSlots()
|
|
|
|
|
|
void EvalSchemeWidget::refreshSchemeView()
|
|
|
{
|
|
|
- qDebug() << __FUNCTION__ << __LINE__ << m_scheme << endl;
|
|
|
+ updateButtonState();
|
|
|
|
|
|
m_schemeView->clear();
|
|
|
if (m_scheme > 0) {
|
|
@@ -166,6 +157,31 @@ void EvalSchemeWidget::testData()
|
|
|
refreshSchemeView();
|
|
|
}
|
|
|
|
|
|
+void EvalSchemeWidget::loadScheme(const QString scheme)
|
|
|
+{
|
|
|
+ if (m_schemes.contains(scheme) == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SchemeAndAlg s = m_schemes[scheme];
|
|
|
+ m_scheme = s.scheme;
|
|
|
+ m_algs.clear();
|
|
|
+ m_algs.append(s.alg);
|
|
|
+ refreshSchemeView();
|
|
|
+}
|
|
|
+
|
|
|
+void EvalSchemeWidget::updateButtonState()
|
|
|
+{
|
|
|
+ bool e = m_scheme > 0 && m_algs.count() > 0;
|
|
|
+
|
|
|
+ m_index->setEnabled(e);
|
|
|
+ m_data->setEnabled(e);
|
|
|
+ m_algBtn->setEnabled(e);
|
|
|
+ m_clear->setEnabled(e);
|
|
|
+
|
|
|
+ m_index->setChecked((m_scheme & Index) == Index);
|
|
|
+ m_data->setChecked((m_scheme & Collect) == Collect);
|
|
|
+}
|
|
|
+
|
|
|
void EvalSchemeWidget::slotShowSchemeMenu()
|
|
|
{
|
|
|
QPoint pos = m_schemeBtn->mapToGlobal(QPoint()) + QPoint(m_schemeBtn->width(), -10);
|