#include "CFDStructMainWindow.h" #include #include #include #include #include #include #include #include #include "CFDMainTreeWidget.h" #include "CFDStructOperatorsModel/CFDStructOperatorsModelSolverProperty.h" #include "CUIProperty/CUIConfig.h" #include "CUIProperty/CUIPropertyWidget.h" #include "FITK_Kernel/FITKCore/FITKAbstractGUIObject.h" #include "GUIFrame/MainTreeWidget.h" #include "GUIFrame/PropertyWidget.h" #include "GUIFrame/RenderWidget.h" #include "GUIFrame/TabWidget.h" #include "Tools/Win64/SARibbon/include/SARibbon-2.0.1/SARibbonBar.h" #include "Tools/Win64/SARibbon/include/SARibbon-2.0.1/SARibbonMainWindow.h" #include "Tools/Win64/SARibbon/include/SARibbon-2.0.1/SARibbonPannelItem.h" using namespace GUI; CFDStructMainWindow::CFDStructMainWindow() { qDebug() << "new Empty CFDStructMainWindow"; CFDStructOperatorsModelSolverProperty::getInstance(); initMainWindowMenu(); initCentralWidget(); initPropertyWidget(); 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); m_PropertyWidget = new PropertyWidget(this); m_PropertyWidget->setMinimumWidth(mainWindSize * 0.65); _treeWidget = new CFDMainTreeWidget(this, m_PropertyWidget); _treeWidget->setMinimumWidth(mainWindSize * 0.4); _treeWidget->setMaximumWidth(mainWindSize * 0.4); 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() { // CUIPropertyWidget* cuiWidget = new CUI(new CUIConfig({ // "type", "Widget", // "name", "main_widget" // }, { // new CUIConfig({ // {"type", "GroupBox"}, // {"name", "模型"}, // }, {}), // new CUIConfig({}, {}), // new CUIConfig({}, {}) // })); QWidget* cuiwidget = new QWidget(); QVBoxLayout* cuilayout = new QVBoxLayout(); cuiwidget->setLayout(cuilayout); QGroupBox* gb1 = new QGroupBox("Model"); cuilayout->addWidget(gb1); gb1->setLayout(new QVBoxLayout()); gb1->layout()->addWidget(new QRadioButton("Inviscid")); gb1->layout()->addWidget(new QRadioButton("Laminar")); gb1->layout()->addWidget(new QRadioButton("RANS")); gb1->layout()->addWidget(new QRadioButton("DES")); gb1->layout()->addWidget(new QRadioButton("CLES")); QGroupBox* gb2 = new QGroupBox("RANS"); cuilayout->addWidget(gb2); gb2->setLayout(new QVBoxLayout()); gb2->layout()->addWidget(new QRadioButton("S-A")); gb2->layout()->addWidget(new QRadioButton("Menters's κ-ω")); gb2->layout()->addWidget(new QRadioButton("κ-ε")); QGroupBox* gb3 = new QGroupBox("S-A type"); cuilayout->addWidget(gb3); gb3->setLayout(new QVBoxLayout()); gb3->layout()->addWidget(new QRadioButton("standard")); gb3->layout()->addWidget(new QRadioButton("Edwards")); QWidget* spacer = new QWidget; spacer->setFixedHeight(400); // 将弹簧添加到布局中 cuilayout->addWidget(spacer); // CUIPropertyWidget* cui = new CUI(new CUIConfig({ // {"type", "Widget"} // }, { // new CUIConfig({ // {"type", "GroupBox"}, // {"name", "GroupBox_name"} // }, {}) // })); // CUIConfig* cuiconfig = new CUIConfig({ // {"type","type"}, // {"name","name"} // }); // cuiconfig->printConfig(); // cuilayout->addWidget(cui->getUI()); QWidget* test = new CUIPropertyWidget( nullptr, new CUIConfig({{"type", "LineEdit"}, {"name", "test"}})); m_PropertyWidget->setWidget(cuiwidget); m_PropertyWidget->setWidget(test); } void CFDStructMainWindow::initMainWindowMenu() { initApplicationButton(); addSARibbonCategoryGeometry(); addSARibbonCategoryMesh(); addSARibbonCategoryCalculation(); addSARibbonCategoryPostProcessing(); addSARibbonCategoryTool(); addSARibbonCategoryCivilAircraftTemplateLibrary(); _ribbonBar->setCurrentIndex(0); } void CFDStructMainWindow::addSARibbonCategoryGeometry() { QString type = tr("Geometry"); SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type); _ribbonBar->raiseCategory(gategory); } void CFDStructMainWindow::addSARibbonCategoryMesh() { QString type = tr("Mesh"); SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type); _ribbonBar->raiseCategory(gategory); } void CFDStructMainWindow::addSARibbonCategoryCalculation() { // ����һ���µı�ǩ QString type = tr("Calculation"); SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type); _ribbonBar->raiseCategory(gategory); QAction* action = nullptr; // pannel ����һ������ "��������" SARibbonPannel* pannel = gategory->addPannel(tr("Simulation Run")); // action = getAction("actionImportGeometry"); // ����һ��ͼ�� "��ʼ����" action = createAction(tr("Start Calculation"), "actionStartCalculation", ":/icons/createbox.png", tr("Start Calculation")); // ��ͼ�����������,������ͼ���С pannelAddAction(pannel, action, SARibbonPannelItem::Large); // �������� "����͵���" pannel = gategory->addPannel(tr("Import and Export")); // ����ͼ��"������" action = createAction(tr("Mesh Import"), "actionMeshImport", ":/img/createbox.png", tr("Mesh Import")); //"������"����"����͵���" pannelAddAction(pannel, action, SARibbonPannelItem::Large); // ����ͼ��"����" action = createAction(tr("Import"), "actionImport", ":/img/test1.png", tr("Import")); // pannelAddAction(pannel, action, SARibbonPannelItem::Large); // pannel = gategory->addPannel(tr("Solver Settings")); // action = createAction(tr("Time Mode"), "actionTimeMode", ":/icons/BoolFause.png", tr("Time Mode")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); // action = createAction(tr("Basic Model"), "actionBasicModel", ":/icons/BoolCut.png", tr("Basic Model")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); // action = createAction(tr("Viscosity Model"), "actionViscosityModel", ":/icons/BoolCommon.png", tr("Viscosity Model")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); // action = createAction(tr("Numerical Method"), "actionNumericalMethod", ":/icons/BoolCommon.png", tr("Numerical Method")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); // action = createAction(tr("Motion Properties"), "actionMotionProperties", ":/icons/BoolCommon.png", tr("Motion Properties")); pannel = gategory->addPannel(tr("Boundary Conditions and Initial Conditions")); action = createAction(tr("Boundary Conditions"), "actionBoundaryConditions", ":/icons/BoolCommon.png", tr("Boundary Conditions")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); action = createAction(tr("Reference Quantities"), "actionReferenceQuantities", ":/icons/BoolCommon.png", tr("Reference Quantities")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); // action = createAction(tr("Initialization"), "actionInitialization", ":/icons/BoolCommon.png", tr("Initialization")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); // � �������"�������" pannel = gategory->addPannel(tr("Computational Control")); // ����ͼ�� ������� action = createAction(tr("Computational Control"), "actionComputational Control", ":/icons/Computational Control.png", tr("Computational Control")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); //� ����"�����" pannel = gategory->addPannel(tr("Monitors")); // ����ͼ�� �в� action = createAction(tr("Residuals"), "actionResiduals", ":/icons/Residuals.png", tr("Residuals")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); // ����ͼ�� ������ action = createAction(tr("Aerodynamic Forces"), "actionAerodynamicForces", ":/icons/AerodynamicForces.png", tr("Aerodynamic Forces")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); // ����ͼ�� ��Ϣ���� action = createAction(tr("Summary"), "actionSummary", ":/icons/Summary.png", tr("Summary")); pannelAddAction(pannel, action, SARibbonPannelItem::Large); } void CFDStructMainWindow::addSARibbonCategoryPostProcessing() { QString type = tr("Post Processing"); SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type); _ribbonBar->raiseCategory(gategory); } void CFDStructMainWindow::addSARibbonCategoryTool() { QString type = tr("Tool"); SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type); _ribbonBar->raiseCategory(gategory); } void CFDStructMainWindow::addSARibbonCategoryCivilAircraftTemplateLibrary() { QString type = tr("CivilAircraft Template sLibrary"); SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type); _ribbonBar->raiseCategory(gategory); }