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; }; }