From 8af4d47713618ab54c9d360d29bbec9b27b383bb Mon Sep 17 00:00:00 2001 From: mzh Date: Fri, 25 Oct 2024 17:27:02 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AE=8C=E6=88=90=E4=B8=AD=E5=A4=AE?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E7=9A=84=E5=B7=A6=E4=BE=A7=E7=9A=84=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E6=A0=91=E7=9A=84=E5=88=9D=E6=AD=A5=E9=87=8D=E5=86=99?= =?UTF-8?q?=202=E3=80=81=E5=AE=8C=E6=88=90=E7=BB=93=E6=9E=84=E6=A0=91?= =?UTF-8?q?=E7=9A=84=E6=B1=82=E8=A7=A3=E5=88=86=E6=9E=90=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CFDStruct/CFDStructGUI/CFDMainTreeWidget.cpp | 111 ++++++++++++++++++ CFDStruct/CFDStructGUI/CFDMainTreeWidget.h | 39 ++++++ CFDStruct/CFDStructGUI/CFDStructGUI.pri | 3 + CFDStruct/CFDStructGUI/CFDStructGUI.pro | 2 + .../CFDStructGUI/CFDStructMainWindow.cpp | 55 +++++++++ CFDStruct/CFDStructGUI/CFDStructMainWindow.h | 2 + GUIFrame/MainTreeWidget.h | 2 +- 7 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 CFDStruct/CFDStructGUI/CFDMainTreeWidget.cpp create mode 100644 CFDStruct/CFDStructGUI/CFDMainTreeWidget.h diff --git a/CFDStruct/CFDStructGUI/CFDMainTreeWidget.cpp b/CFDStruct/CFDStructGUI/CFDMainTreeWidget.cpp new file mode 100644 index 0000000..73bc0c2 --- /dev/null +++ b/CFDStruct/CFDStructGUI/CFDMainTreeWidget.cpp @@ -0,0 +1,111 @@ +#include "CFDMainTreeWidget.h" + +#include "GUIWidget/TreeWidget.h" + +namespace GUI{ + + CFDMainTreeWidget::CFDMainTreeWidget(MainWindow *parent) : MainTreeWidget(parent) + { +// this->setWidget(_treeWidget); + + init(); + } + + void CFDMainTreeWidget::init() + { + QTabWidget* tabWidget = new QTabWidget; + this->setWidget(tabWidget); + +// tabWidget->addTab(_treeWidget,tr("Solution Analysis")); + + addTreePreprocessing(tabWidget); + addTreeSolutionAnalysis(tabWidget); + addTreePostprocessing(tabWidget); + } + + void CFDMainTreeWidget::addTreePreprocessing(QTabWidget *tabWidget) + { + _treePreprocessing = new TreeWidget(this); + tabWidget->addTab(_treePreprocessing,tr("Preprocessing")); + + _treePreprocessing->updateTree(); + } + + void CFDMainTreeWidget::addTreeSolutionAnalysis(QTabWidget *tabWidget) + { + _treeSolutionAnalysis = new TreeWidget(this); + tabWidget->addTab(_treeSolutionAnalysis,tr("SolutionAnalysis")); + + + QTreeWidgetItem* GeometryAndMeshingItem = new QTreeWidgetItem(); + GeometryAndMeshingItem->setText(0,tr("Geometry and Meshing")); + GeometryAndMeshingItem->setData(1,0,-1); +// GeometryAndMeshingItem->setData(2, 0, QVariant::fromValue(GUI::MainTreeEnum::MainTree_Mesh)); + _treeSolutionAnalysis->addTopLevelItem(GeometryAndMeshingItem); + + QTreeWidgetItem* mesh = new QTreeWidgetItem(); + mesh->setText(0,tr("Mesh001")); + mesh->setData(1,0,-1); + GeometryAndMeshingItem->addChild(mesh); + + + QTreeWidgetItem* ComputationalSetupItem = new QTreeWidgetItem(); + ComputationalSetupItem->setText(0,tr("Computational Setup")); + ComputationalSetupItem->setData(1,0,-1); + _treeSolutionAnalysis->addTopLevelItem(ComputationalSetupItem); + + QTreeWidgetItem* TimeModeItem = new QTreeWidgetItem(); + TimeModeItem->setText(0,tr("Time Mode")); + TimeModeItem->setData(1,0,-1); + ComputationalSetupItem->addChild(TimeModeItem); + + QTreeWidgetItem* ComputationalDomainItem = new QTreeWidgetItem(); + ComputationalDomainItem->setText(0,tr("Computational Domain")); + ComputationalDomainItem->setData(1,0,-1); + ComputationalSetupItem->addChild(ComputationalDomainItem); + + + QTreeWidgetItem* SolverItem = new QTreeWidgetItem(); + SolverItem->setText(0,tr("Solver")); + SolverItem->setData(1,0,-1); + ComputationalDomainItem->addChild(SolverItem); + + QTreeWidgetItem* MotionPropertiesItem = new QTreeWidgetItem(); + MotionPropertiesItem->setText(0,tr("Motion Properties")); + MotionPropertiesItem->setData(1,0,-1); + ComputationalDomainItem->addChild(MotionPropertiesItem); + + QTreeWidgetItem* BoundaryConditionsItem = new QTreeWidgetItem(); + BoundaryConditionsItem->setText(0,tr("Boundary Conditions")); + BoundaryConditionsItem->setData(1,0,-1); + ComputationalDomainItem->addChild(BoundaryConditionsItem); + + QTreeWidgetItem* InitializationItem = new QTreeWidgetItem(); + InitializationItem->setText(0,tr("Initialization")); + InitializationItem->setData(1,0,-1); + ComputationalDomainItem->addChild(InitializationItem); + + QTreeWidgetItem* ComputationalControlItem = new QTreeWidgetItem(); + ComputationalControlItem->setText(0,tr("Computational Control")); + ComputationalControlItem->setData(1,0,-1); + ComputationalDomainItem->addChild(ComputationalControlItem); + + QTreeWidgetItem* MonitorsItem = new QTreeWidgetItem(); + MonitorsItem->setText(0,tr("Monitors")); + MonitorsItem->setData(1,0,-1); + ComputationalDomainItem->addChild(MonitorsItem); + + + } + + void CFDMainTreeWidget::addTreePostprocessing(QTabWidget *tabWidget) + { + _treePostprocessing = new TreeWidget(this); + tabWidget->addTab(_treePostprocessing,tr("Postprocessing")); + + } + + + + +} diff --git a/CFDStruct/CFDStructGUI/CFDMainTreeWidget.h b/CFDStruct/CFDStructGUI/CFDMainTreeWidget.h new file mode 100644 index 0000000..620dbf4 --- /dev/null +++ b/CFDStruct/CFDStructGUI/CFDMainTreeWidget.h @@ -0,0 +1,39 @@ +#ifndef CFDMainTreeWidget_h +#define CFDMainTreeWidget_h + +#include +#include +#include +#include + +class MainWindow; +class QTabWidget; + +namespace GUI{ + + class CFDStructGUIAPI CFDMainTreeWidget : public MainTreeWidget{ + Q_OBJECT + + public: + CFDMainTreeWidget(MainWindow* parent); + + + private: + void init(); + + void addTreePreprocessing(QTabWidget* tabWidget); + + void addTreeSolutionAnalysis(QTabWidget* tabWidget); + + void addTreePostprocessing(QTabWidget* tabWidget); + + + TreeWidget* _treePreprocessing; + TreeWidget* _treeSolutionAnalysis; + TreeWidget* _treePostprocessing; + + }; + +} + +#endif diff --git a/CFDStruct/CFDStructGUI/CFDStructGUI.pri b/CFDStruct/CFDStructGUI/CFDStructGUI.pri index 37e679f..1b2bfac 100644 --- a/CFDStruct/CFDStructGUI/CFDStructGUI.pri +++ b/CFDStruct/CFDStructGUI/CFDStructGUI.pri @@ -1,6 +1,9 @@ HEADERS += \ $$PWD/CFDStructGUIAPI.h \ $$PWD/CFDStructMainWindow.h \ + $$PWD/CFDMainTreeWidget.h \ SOURCES += \ $$PWD/CFDStructMainWindow.cpp \ + $$PWD/CFDMainTreeWidget.cpp \ + diff --git a/CFDStruct/CFDStructGUI/CFDStructGUI.pro b/CFDStruct/CFDStructGUI/CFDStructGUI.pro index 8e07355..b62ccd1 100644 --- a/CFDStruct/CFDStructGUI/CFDStructGUI.pro +++ b/CFDStruct/CFDStructGUI/CFDStructGUI.pro @@ -33,6 +33,7 @@ win32{ -L../../output/bin \ -lGUIFrame \ -lCUIProperty \ + -lGUIWidget \ Debug:CONFIG += console @@ -45,6 +46,7 @@ win32{ -L../../output/bin_d \ -lGUIFrame \ -lCUIProperty \ + -lGUIWidget \ Debug:LIBS += -L$$PWD/../../Tools/Win64/SARibbon/libd/ \ -lSARibbonBard \ diff --git a/CFDStruct/CFDStructGUI/CFDStructMainWindow.cpp b/CFDStruct/CFDStructGUI/CFDStructMainWindow.cpp index f34b400..9e963a9 100644 --- a/CFDStruct/CFDStructGUI/CFDStructMainWindow.cpp +++ b/CFDStruct/CFDStructGUI/CFDStructMainWindow.cpp @@ -1,6 +1,10 @@ #include "CFDStructMainWindow.h" +#include "CFDMainTreeWidget.h" #include "GUIFrame/PropertyWidget.h" +#include "GUIFrame/MainTreeWidget.h" +#include "GUIFrame/RenderWidget.h" +#include "GUIFrame/TabWidget.h" #include "CUIProperty/CUIConfig.h" #include "CUIProperty/CUI.h" @@ -16,6 +20,7 @@ #include #include #include +#include //CFDStructMainWindow::CFDStructMainWindow() : GUI::MainWindow() //{ @@ -39,6 +44,56 @@ CFDStructMainWindow::CFDStructMainWindow() { setWindowTitle("AreoFlow"); } +void CFDStructMainWindow::initCentralWidget() +{ + + // 子部件水平排布 + QSplitter* spliterLayout = new QSplitter(Qt::Horizontal); + spliterLayout->setMouseTracking(true); + spliterLayout->setHandleWidth(5); + + int mainWindSize = QMainWindow::width(); +// _treeWidget = new MainTreeWidget(this); + _treeWidget = new CFDMainTreeWidget(this); + + _treeWidget->setMinimumWidth(mainWindSize * 0.4); + _treeWidget->setMaximumWidth(mainWindSize * 0.4); + m_PropertyWidget = new PropertyWidget(this); + m_PropertyWidget->setMinimumWidth(mainWindSize * 0.65); + m_RenderWidget = new RenderWidget(this); + _tabWidgete = new TabWidget(this); + //m_GroupPropertyWidget = new GroupPropertyWidget(this); + + //添加树界面 + spliterLayout->addWidget(_treeWidget); + + + //添加属性界面 + spliterLayout->addWidget(m_PropertyWidget); + + QSplitter* verLayout = new QSplitter(Qt::Vertical); + spliterLayout->setMouseTracking(true); + spliterLayout->setHandleWidth(5); + verLayout->addWidget(m_RenderWidget); + verLayout->addWidget(_tabWidgete); + + spliterLayout->addWidget(verLayout); + //spliterLayout->addWidget(m_GroupPropertyWidget); + // 设置大小 + spliterLayout->setSizes({ 200, 300, 1000, 200 }); + + auto mainLayout = new QGridLayout(); + mainLayout->setObjectName("CentralGridLayout"); + mainLayout->setContentsMargins(5, 5, 5, 10); + mainLayout->addWidget(spliterLayout); + + _currentWidget->setLayout(mainLayout); + setCentralWidget(_currentWidget); + +} + + + void CFDStructMainWindow::initPropertyWidget() { //CUI* cuiWidget = new CUI(new CUIConfig({ // "type", "Widget", diff --git a/CFDStruct/CFDStructGUI/CFDStructMainWindow.h b/CFDStruct/CFDStructGUI/CFDStructMainWindow.h index 2774e18..4db96aa 100644 --- a/CFDStruct/CFDStructGUI/CFDStructMainWindow.h +++ b/CFDStruct/CFDStructGUI/CFDStructMainWindow.h @@ -29,6 +29,8 @@ class CFDStructGUIAPI CFDStructMainWindow : public GUI::MainWindow { * @return none*/ void init(); + void initCentralWidget(); + /** * @brief ȾԽ * @return none*/ diff --git a/GUIFrame/MainTreeWidget.h b/GUIFrame/MainTreeWidget.h index 798d418..3228684 100644 --- a/GUIFrame/MainTreeWidget.h +++ b/GUIFrame/MainTreeWidget.h @@ -54,7 +54,7 @@ namespace GUI TreeWidget* getTreeWidget(); - private: + protected: TreeWidget* _treeWidget = nullptr; }; }