소스 검색

报告图形

chengxr 1 년 전
부모
커밋
f3ad3963eb
6개의 변경된 파일196개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 0
      QFD/QFD.pro
  2. 73 1
      QFD/view/AlgorithmManageView.cpp
  3. 21 2
      QFD/view/AlgorithmManageView.h
  4. 3 1
      QFD/widgets/DataProcessingWidget.cpp
  5. 74 0
      QFD/widgets/EvalReportWidget.cpp
  6. 23 0
      QFD/widgets/EvalReportWidget.h

+ 2 - 0
QFD/QFD.pro

@@ -104,6 +104,7 @@ SOURCES += \
     widgets/DataProcessingWidget.cpp \
     widgets/DataTableWidget.cpp \
     widgets/EditNodeWidget.cpp \
+    widgets/EvalReportWidget.cpp \
     widgets/EvalSchemeWidget.cpp \
     widgets/EvalWidget.cpp \
     widgets/EvaluateOptionWidget.cpp \
@@ -160,6 +161,7 @@ HEADERS += \
     widgets/DataProcessingWidget.h \
     widgets/DataTableWidget.h \
     widgets/EditNodeWidget.h \
+    widgets/EvalReportWidget.h \
     widgets/EvalSchemeWidget.h \
     widgets/EvalWidget.h \
     widgets/EvaluateOptionWidget.h \

+ 73 - 1
QFD/view/AlgorithmManageView.cpp

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

+ 21 - 2
QFD/view/AlgorithmManageView.h

@@ -1,16 +1,35 @@
-#ifndef ALGORITHMMANAGEVIEW_H
+#ifndef ALGORITHMMANAGEVIEW_H
 #define ALGORITHMMANAGEVIEW_H
 
 #include <QWidget>
 
+class QVBoxLayout;
+class QLabel;
+class QHBoxLayout;
+class QListWidget;
+
 class AlgorithmManageView : public QWidget
 {
     Q_OBJECT
 public:
     explicit AlgorithmManageView(QWidget *parent = nullptr);
 
+private:
+    void initWidgets();
+
+    void initLayouts();
+
+    void showAlgs();
+
 signals:
 
+private:
+    QVBoxLayout *m_layout    = nullptr;
+    QLabel *m_titleLabel     = nullptr;
+    QHBoxLayout *m_topLayout = nullptr;
+
+    QStringList m_algList;
+    QListWidget *m_listWidget = nullptr;
 };
 
-#endif // ALGORITHMMANAGEVIEW_H
+#endif  // ALGORITHMMANAGEVIEW_H

+ 3 - 1
QFD/widgets/DataProcessingWidget.cpp

@@ -1,5 +1,7 @@
 #include "DataProcessingWidget.h"
 
+#include "EvalReportWidget.h"
+
 #include <QTabWidget>
 
 DataProcessingWidget::DataProcessingWidget(ProjectInfo *proj, QWidget *parent) : EvalWidget(proj, parent)
@@ -17,7 +19,7 @@ void DataProcessingWidget::setupTabWidget()
 {
     m_tab->clear();
     for (int i : indexList()) {
-        QWidget *m                  = new QWidget(this);
+        EvalReportWidget *m         = new EvalReportWidget(this);
         ProjectManager::IndexType t = (ProjectManager::IndexType)i;
         QString s                   = ProjectManager::nameOfIndexType(t);
         m_tab->addTab(m, s);

+ 74 - 0
QFD/widgets/EvalReportWidget.cpp

@@ -0,0 +1,74 @@
+#include "EvalReportWidget.h"
+
+#include "view/PlotView.h"
+#include "CustomPieChart.h"
+
+#include <QLabel>
+#include <QBoxLayout>
+
+EvalReportWidget::EvalReportWidget(QWidget *parent) : QWidget(parent)
+{
+
+    m_view   = new QWidget;
+    m_layout = new QVBoxLayout(m_view);
+
+    addContents();
+
+    QScrollArea *scroll = new QScrollArea;
+    scroll->setAlignment(Qt::AlignLeft);
+    scroll->setWidget(m_view);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setMargin(0);
+    layout->addWidget(scroll);
+}
+
+void EvalReportWidget::addContents()
+{
+    QVector<PlotView::Data> v;
+
+    QList<int> values = { 26, 96, 28, 45, 67, 89 };
+    QStringList names;
+    QList<QColor> colors;
+
+    for (int i = 0; i < values.count(); i++) {
+        PlotView::Data d;
+        d.name  = QString("%1").arg(i);
+        d.value = values[i] / 100.0;
+        v.append(d);
+
+        names.append(d.name);
+        colors.append(QColor::fromRgbF(i * 1.0 / values.count(), 0.5, (values.count() - i) * 1.0 / values.count(), 1));
+    }
+
+    QSize s = QSize(500, 500);
+
+    PlotView *w1 = new PlotView(PlotView::Line, v, "折线图", this);
+    w1->setFixedSize(s);
+    w1->plot();
+    m_layout->addWidget(w1);
+
+    PlotView *w2 = new PlotView(PlotView::HistogramHorizontal, v, "特征值", this);
+    w2->setFixedSize(s);
+    w2->plot();
+    m_layout->addWidget(w2);
+
+    PlotView *w3 = new PlotView(PlotView::HistogramVertical, v, "柱状图", this);
+    w3->setFixedSize(s);
+    w3->plot();
+    m_layout->addWidget(w3);
+
+    PlotView *w4 = new PlotView(PlotView::Curve, v, "曲线图", this);
+    w4->setFixedSize(s);
+    w4->plot();
+    m_layout->addWidget(w4);
+
+    PlotView *w5 = new PlotView(PlotView::Area, v, "面积图", this);
+    w5->setFixedSize(s);
+    w5->plot();
+    m_layout->addWidget(w5);
+
+    CustomPieChart *w6 = new CustomPieChart("title", names, values, colors, this);
+    w6->setFixedSize(s);
+    m_layout->addWidget(w6);
+}

+ 23 - 0
QFD/widgets/EvalReportWidget.h

@@ -0,0 +1,23 @@
+#ifndef EVALREPORTWIDGET_H
+#define EVALREPORTWIDGET_H
+
+#include <QWidget>
+
+class QVBoxLayout;
+
+class EvalReportWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit EvalReportWidget(QWidget *parent = nullptr);
+
+private:
+    void addContents();
+
+private:
+    QWidget *m_view = nullptr;
+
+    QVBoxLayout *m_layout = nullptr;
+};
+
+#endif  // EVALREPORTWIDGET_H