瀏覽代碼

项目页面侧边栏

chengxr 1 年之前
父節點
當前提交
fd113b8e6c
共有 3 個文件被更改,包括 71 次插入17 次删除
  1. 6 10
      QFD/view/MainWindow.cpp
  2. 54 4
      QFD/view/ProjectView.cpp
  3. 11 3
      QFD/view/ProjectView.h

+ 6 - 10
QFD/view/MainWindow.cpp

@@ -10,16 +10,12 @@
 #include "SettingView.h"
 #include "UserView.h"
 
-#include "CMind.h"
-
 #include "dbService/ClassSet.h"
 
 #include "QFDConfig.h"
 
 #include "common/QFDIcon.h"
 
-#include "CCanvas/CMindView.h"
-
 #include <QFramelessWindow.h>
 
 #include <Navigation/NavigationInterface.h>
@@ -243,16 +239,16 @@ void MainWindow::slotOpenProject(ProjectInfo *proj)
     if (index >= 0) {
         m_stackWidget->setCurrentIndex(index);
     } else {
-        CMindView *m = new CMindView(m_mainWidget);
+        ProjectView *p = new ProjectView(proj, m_mainWidget);
 
-        m->setObjectName(n);
-        m_stackWidget->addWidget(m);
+        p->setObjectName(n);
+        m_stackWidget->addWidget(p);
 
         QString t = QString("打开项目-%1").arg(proj->projectName);
-        m_naviInterface->addItem(m->objectName(), NEWFLICON(QFDIcon, Project), t, this, SLOT(slotNaviItemClicked()),
+        m_naviInterface->addItem(p->objectName(), NEWFLICON(QFDIcon, Project), t, this, SLOT(slotNaviItemClicked()),
                                  true, NavigationItemPosition::SCROLL);
-        m_stackWidget->setCurrentWidget(m);
+        m_stackWidget->setCurrentWidget(p);
 
-        m->setWindowTitle(t);
+        p->setWindowTitle(t);
     }
 }

+ 54 - 4
QFD/view/ProjectView.cpp

@@ -4,8 +4,13 @@
 #include "RenameWidget.h"
 #include "ConfigExpertWidget.h"
 
+#include "common/ProjectManager.h"
+
+#include <dbService/ClassSet.h>
+
 #include <Widgets/Button.h>
 #include <Widgets/LineEdit.h>
+#include <Widgets/TreeView.h>
 
 #include <QBoxLayout>
 #include <QLabel>
@@ -36,13 +41,58 @@ ProjectInfo *ProjectView::proj() const
     return m_proj;
 }
 
-void ProjectView::setProject(ProjectInfo *proj)
+void ProjectView::initWidgets()
 {
-    m_proj = proj;
+    m_title = new QLabel(this);
+    m_title->setText(m_proj->projectName);
+    QFont ft("Microsoft YaHei", 14);
+    m_title->setFont(ft);
+
+    m_close = new PushButton("关闭", this);
+
+    m_tree = new TreeWidget(this);
+
+    QList<ProjectManager::EvalType> types = ProjectManager::evalTypeList(*m_proj);
+    for (int i = 0; i < types.count(); i++) {
+        QString projName      = ProjectManager::nameOfEvalType(types[i]);
+        QTreeWidgetItem *item = new QTreeWidgetItem({ projName });
+        item->addChildren({ new QTreeWidgetItem({ "指标体系设计" }), new QTreeWidgetItem({ "评估方案规划" }),
+                            new QTreeWidgetItem({ "评估数据采集" }), new QTreeWidgetItem({ "评估数据处理" }) });
+        m_tree->addTopLevelItem(item);
+    }
+
+    m_tree->expandAll();
+    m_tree->setHeaderHidden(true);
+    m_tree->setFixedWidth(300);
+
+    m_contentSeperator = new QWidget(this);
+    m_contentSeperator->setFixedWidth(1);
+
+    QPalette pal(m_contentSeperator->palette());
+
+    //设置背景黑色
+    pal.setColor(QPalette::Background, Qt::black);
+    m_contentSeperator->setAutoFillBackground(true);
+    m_contentSeperator->setPalette(pal);
 }
 
-void ProjectView::initWidgets() { }
+void ProjectView::initLayout()
+{
+    m_layout       = new QVBoxLayout(this);
+    m_headerLayout = new QHBoxLayout();
+    m_layout->addLayout(m_headerLayout);
+    m_contentLayout = new QHBoxLayout();
+    m_layout->addLayout(m_contentLayout);
+    //    m_layout->addStretch();
+
+    m_headerLayout->addWidget(m_title);
+    m_headerLayout->addStretch();
+    m_headerLayout->addWidget(m_close);
+    m_headerLayout->addSpacing(10);
 
-void ProjectView::initLayout() { }
+    m_contentLayout->addWidget(m_tree);
+    m_contentLayout->addWidget(m_contentSeperator);
+    m_contentLayout->addStretch();
+}
 
 void ProjectView::connectSigalsAndSlots() { }

+ 11 - 3
QFD/view/ProjectView.h

@@ -5,6 +5,9 @@
 
 class ProjectInfo;
 
+class PushButton;
+class TreeWidget;
+
 class QVBoxLayout;
 class QHBoxLayout;
 class QLabel;
@@ -21,8 +24,6 @@ public:
 
     ProjectInfo *proj() const;
 
-    void setProject(ProjectInfo *proj);
-
 signals:
 
 private:
@@ -35,7 +36,14 @@ private:
 
     bool m_initilized = false;
 
-    QHBoxLayout *m_layout = nullptr;
+    QVBoxLayout *m_layout        = nullptr;
+    QHBoxLayout *m_headerLayout  = nullptr;
+    QHBoxLayout *m_contentLayout = nullptr;
+
+    QLabel *m_title             = nullptr;
+    PushButton *m_close         = nullptr;
+    TreeWidget *m_tree          = nullptr;
+    QWidget *m_contentSeperator = nullptr;
 };
 
 #endif  // PROJECTVIEW_H