|
@@ -1,6 +1,78 @@
|
|
|
-#include "AlgorithmManageView.h"
|
|
|
+#include "AlgorithmManageView.h"
|
|
|
+
|
|
|
+#include <QLabel>
|
|
|
+#include <QBoxLayout>
|
|
|
+#include <QListWidget>
|
|
|
+#include <QStringList>
|
|
|
|
|
|
AlgorithmManageView::AlgorithmManageView(QWidget *parent) : QWidget(parent)
|
|
|
{
|
|
|
+ initWidgets();
|
|
|
+ initLayouts();
|
|
|
+
|
|
|
+ m_algList.append("主成分分析法");
|
|
|
+ m_algList.append("熵值法");
|
|
|
+ m_algList.append("层次分析法");
|
|
|
+ m_algList.append("层次加权法");
|
|
|
+ m_algList.append("集对分析法");
|
|
|
+ m_algList.append("物元分析法");
|
|
|
+ m_algList.append("灰色聚类评估法");
|
|
|
+
|
|
|
+ showAlgs();
|
|
|
+}
|
|
|
+
|
|
|
+/*
|
|
|
+ QVBoxLayout *m_vBoxLayout = nullptr;
|
|
|
+ QLabel *m_titleLabel = nullptr;
|
|
|
+ QHBoxLayout *m_hBoxLayout = nullptr;
|
|
|
+
|
|
|
+QListWidget *m_listWidget = nullptr;
|
|
|
+*/
|
|
|
+
|
|
|
+void AlgorithmManageView::initWidgets()
|
|
|
+{
|
|
|
+ m_titleLabel = new QLabel(this);
|
|
|
+ m_titleLabel->setText("算法列表");
|
|
|
+ QFont ft("Microsoft YaHei", 12);
|
|
|
+ m_titleLabel->setFont(ft);
|
|
|
+ m_listWidget = new QListWidget(this);
|
|
|
+ m_listWidget->setAlternatingRowColors(true);
|
|
|
+ m_listWidget->setStyleSheet("QListWidget {border: 1px solid rgba(0, 0, 0, 0.073);background: rgb(255, 255, "
|
|
|
+ "255);alternate-background-color: rgb(244, 244, 255);}");
|
|
|
+}
|
|
|
+
|
|
|
+void AlgorithmManageView::initLayouts()
|
|
|
+{
|
|
|
+ m_layout = new QVBoxLayout(this);
|
|
|
+ m_topLayout = new QHBoxLayout();
|
|
|
+ m_layout->addLayout(m_topLayout);
|
|
|
+ m_layout->addWidget(m_listWidget);
|
|
|
+
|
|
|
+ m_topLayout->addWidget(m_titleLabel);
|
|
|
+}
|
|
|
+
|
|
|
+void AlgorithmManageView::showAlgs()
|
|
|
+{
|
|
|
+ m_listWidget->clear();
|
|
|
+
|
|
|
+ for (int i = 0; i < m_algList.count(); i++) {
|
|
|
+ QListWidgetItem *item = new QListWidgetItem;
|
|
|
+ item->setSizeHint(QSize(200, 60));
|
|
|
+ m_listWidget->addItem(item);
|
|
|
+
|
|
|
+ QWidget *w = new QWidget();
|
|
|
+ m_listWidget->setItemWidget(item, w);
|
|
|
+
|
|
|
+ QHBoxLayout *hBox = new QHBoxLayout(w);
|
|
|
+ hBox->setSpacing(0);
|
|
|
+ hBox->setMargin(10);
|
|
|
|
|
|
+ QLabel *idx = new QLabel(QString::number(i + 1));
|
|
|
+ idx->setFixedWidth(20);
|
|
|
+ hBox->addWidget(idx);
|
|
|
+ hBox->addSpacing(10);
|
|
|
+ QLabel *name = new QLabel(m_algList[i]);
|
|
|
+ hBox->addWidget(name);
|
|
|
+ hBox->addStretch();
|
|
|
+ }
|
|
|
}
|