1、实现时间模式的设置界面和一个参数到内存的关联,以及参数之间的关联;

feature/struct-menu-20241023
simonyan 2 weeks ago
parent 57a590f984
commit 102aa1de3c

@ -15,8 +15,7 @@ namespace ModelOper
{
CFDOperatorsBasicModelManager::CFDOperatorsBasicModelManager()
{
qDebug()<<"build Time Mode Manager";
qDebug() << "build Time Mode Manager";
}
CFDOperatorsBasicModelManager::~CFDOperatorsBasicModelManager()
@ -26,12 +25,14 @@ namespace ModelOper
bool CFDOperatorsBasicModelManager::execGUI()
{
QWidget* widget = nullptr;
GUI::MainWindow* mainWindow = dynamic_cast<GUI::MainWindow*>(FITKAPP->getGlobalData()->getMainWindow());
if (mainWindow == nullptr)return false;
if (mainWindow == nullptr) {
return false;
}
GUI::PropertyWidget* propertyWidget = mainWindow->getPropertyWidget();
if (propertyWidget == nullptr)return false;
if (propertyWidget == nullptr) {
return false;
}
// switch (_operType){
// case ModelOper::OperManagerBase::Edit:
// {
@ -39,62 +40,58 @@ namespace ModelOper
// break;
// }
// }
qDebug()<<"Time Mode Manager11111111111";
qDebug() << "Time Mode Manager11111111111";
widget = new QLabel("Time Mode Manager11111");
CUI* cui = new CUI(new CUIConfig({
{"type","Widget"}
},{
new CUIConfig({
{"type","LineEidt"},
{"name","Solver type"}
}),
new CUIConfig({
{"type","ComboBox"},
{"name","flow model"}
},{}),
new CUIConfig({
{"type","PushButton"},
{"name","flow model"}
}),
new CUIConfig({
{"type","GroupBox"},
{"name","Fluid properties"}
},{
new CUIConfig({
{"type","LineEdit"},
{"name","Gas composition"}
}),
new CUIConfig({
{"type","LineEdit"},
{"name","Gas constant (R)"}
}),
new CUIConfig({
{"type","LineEdit"},
{"name","Heat ratio"}
}),
new CUIConfig({
{"type","LineEdit"},
{"name","Laminar Prandtl number"}
}),
new CUIConfig({
{"type","LineEdit"},
{"name","Turbulent Prandtl number"}
}),
})
}));
widget = cui->getUI();
// CUI* cui = new CUI(new CUIConfig({
// {"type","Widget"}
// },{
// new CUIConfig({
// {"type","LineEidt"},
// {"name","Solver type"}
// }),
// new CUIConfig({
// {"type","ComboBox"},
// {"name","flow model"}
// },{}),
// new CUIConfig({
// {"type","PushButton"},
// {"name","flow model"}
// }),
// new CUIConfig({
// {"type","GroupBox"},
// {"name","Fluid properties"}
// },{
// new CUIConfig({
// {"type","LineEdit"},
// {"name","Gas composition"}
// }),
// new CUIConfig({
// {"type","LineEdit"},
// {"name","Gas constant (R)"}
// }),
// new CUIConfig({
// {"type","LineEdit"},
// {"name","Heat ratio"}
// }),
// new CUIConfig({
// {"type","LineEdit"},
// {"name","Laminar Prandtl number"}
// }),
// new CUIConfig({
// {"type","LineEdit"},
// {"name","Turbulent Prandtl number"}
// }),
// })
// }));
// widget = cui->getUI();
// if (mainWindow->getPropertyWidget() && widget) {
propertyWidget->setWidget(widget);
propertyWidget->setWidget(widget);
// }
return false;
}
bool CFDOperatorsBasicModelManager::execProfession()
{
return true;
return true;
}
}

@ -7,6 +7,8 @@
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "CFDStruct/CUIProperty/CUI.h"
#include "CUIProperty/CUIConfig.h"
#include "CFDStructDataManager/CFDStructDataManager.h"
#include "CFDStructDataManager/CFDStructSigsCenter.h"
#include <QLabel>
#include <QDebug>
@ -16,6 +18,13 @@ namespace ModelOper
CFDOperatorsTimeModeManager::CFDOperatorsTimeModeManager()
{
qDebug() << "build Time Mode Manager";
CFDStructSigsCenter* sigsCenter = CFDStructSigsCenter::getInstance();
connect(sigsCenter, &CFDStructSigsCenter::sig_solverTimeModeDataChanged, this, [ = ]() {
QObject sender;
sender.setObjectName("actionTimeModeEdit");
this->setEmitter(&sender);
this->execGUI();
});
}
CFDOperatorsTimeModeManager::~CFDOperatorsTimeModeManager()
@ -33,41 +42,15 @@ namespace ModelOper
if (propertyWidget == nullptr) {
return false;
}
// switch (_operType){
// case ModelOper::OperManagerBase::Edit:
// {
// widget = new GUI::TimeModeWidget(this);
// break;
// }
// }
qDebug() << " ---------------------- senderName: " << _senderName;
qDebug() << "Time Mode Manager11111111111";
widget = new QLabel("Time Mode Manager11111");
CUI* cui = new CUI(new CUIConfig({
{"type", "Widget"}
}, {
new CUIConfig({
{"type", "ComboBox"},
{"name", "Time Mode"},
}, {
new CUIConfig({
{"type", "Item"},
{"name", "steady"}
}),
new CUIConfig({
{"type", "Item"},
{"name", "unsteady"}
})
}),
new CUIConfig({
{"type", "LineEdit"},
{"name", "iteration count"}
}, {})
}));
widget = cui->getUI();
// if (mainWindow->getPropertyWidget() && widget) {
if (_senderName == "actionTimeModeEdit") {
CUIConfig* uiConfig = CFDStructDataManager::getInstance()->getActionParamUIConfig(1);
// uiConfig->printConfig();
widget = new CUI(nullptr, uiConfig);
}
propertyWidget->setWidget(widget);
// }
return false;
}

@ -5,11 +5,13 @@
#include "OperatorsModel/OperManagerBase.h"
//#include "CFDStructDataManager/CFDStructDataManager.h"
namespace ModelOper {
namespace ModelOper
{
class CFDOperatorsTimeModeManager : public OperManagerBase {
class CFDOperatorsTimeModeManager : public OperManagerBase
{
Q_OBJECT;
public:
public:
/**
* @brief Construct a new Operators Mesh Base Manager object
*/

@ -11,6 +11,7 @@ Q_DECLARE_METATYPE(int*)
Q_DECLARE_METATYPE(bool*)
Q_DECLARE_METATYPE(double*)
Q_DECLARE_METATYPE(QString*)
Q_DECLARE_METATYPE(QString)
#endif // CFDSTRUCTDATADEFINE_H

@ -3,9 +3,10 @@
#include "CFDStructDataSolverTimeModeManager.h"
#include "CUIProperty/CUIConfig.h"
CFDStructDataManager* m_instance = NULL;
CFDStructDataManager* CFDStructDataManager::m_instance = NULL;
CFDStructDataManager::CFDStructDataManager()
{
this->initDataManagers();
}
CFDStructDataManager *CFDStructDataManager::getInstance()
@ -16,8 +17,9 @@ CFDStructDataManager *CFDStructDataManager::getInstance()
return m_instance;
}
CUIConfig CFDStructDataManager::getActionParamUIConfig(int i)
CUIConfig* CFDStructDataManager::getActionParamUIConfig(int i)
{
return m_solverTimeModeManager->getParamUIConfig();
}
void CFDStructDataManager::initDataManagers()

@ -1,9 +1,11 @@
SOURCES += \
$$PWD/CFDStructDataSolverTimeModeManager.cpp \
$$PWD/CFDStructSigsCenter.cpp \
CFDStructDataManager.cpp \
HEADERS += \
$$PWD/CFDStructDataDefine.h \
$$PWD/CFDStructDataSolverTimeModeManager.h \
$$PWD/CFDStructSigsCenter.h \
CFDStructDataManager_global.h \
CFDStructDataManager.h

@ -59,6 +59,7 @@ win32{
-lFITKInterfaceFlowOF \
-lFITKFlowOFIOHDF5 \
-lOperatorsModel \
-lCUIProperty \
# -lCFDStructDataManager \
@ -91,6 +92,7 @@ win32{
-lFITKInterfaceFlowOF \
-lFITKFlowOFIOHDF5 \
-lOperatorsModel \
-lCUIProperty \
# -lCFDStructDataManager \

@ -1,8 +1,11 @@
#include "CFDStructDataSolverTimeModeManager.h"
#include "CUIProperty/CUIConfig.h"
#include "CFDStructDataDefine.h"
#include <QVariant>
CFDStructDataSolverTimeModeManager::CFDStructDataSolverTimeModeManager(QObject *parent) : QObject(parent)
{
m_uiConfig = nullptr;
}
CFDStructDataSolverTimeModeManager::~CFDStructDataSolverTimeModeManager()
@ -22,29 +25,35 @@ CUIConfig *CFDStructDataSolverTimeModeManager::getParamUIConfig()
// 如果是定常
if (m_runtype == 0) {
m_uiConfig = this->genSteadyModeUIConfig();
qDebug() << " steady ============";
} else {
// 如果是非定常
m_uiConfig = this->genUnsteadyModeUIConfig();
qDebug() << " unsteady ============";
}
m_uiConfig->printConfig();
return m_uiConfig;
}
CUIConfig *CFDStructDataSolverTimeModeManager::genSteadyModeUIConfig()
{
return new CUIConfig({
{"type", "Widget"}
}, {
{"type", "Widget"}}, {
new CUIConfig({
{"type", "ComboBox"},
{"name", "Time Mode"},
{"valueType", "Int"},
{"valueOrigin", QVA_GLOBAL(&m_runtype)}
}, {
new CUIConfig({
{"type", "Item"},
{"name", "steady"}
{"name", "steady"},
{"data", "0"},
}),
new CUIConfig({
{"type", "Item"},
{"name", "unsteady"}
{"name", "unsteady"},
{"data", "1"},
})
}),
new CUIConfig({
@ -53,7 +62,6 @@ CUIConfig *CFDStructDataSolverTimeModeManager::genSteadyModeUIConfig()
})
});
}
CUIConfig *CFDStructDataSolverTimeModeManager::genUnsteadyModeUIConfig()
{
return new CUIConfig({
@ -62,6 +70,8 @@ CUIConfig *CFDStructDataSolverTimeModeManager::genUnsteadyModeUIConfig()
new CUIConfig({
{"type", "ComboBox"},
{"name", "Time Mode"},
{"valueType", "Int"},
{"valueOrigin", QVA_GLOBAL(&m_runtype)}
}, {
new CUIConfig({
{"type", "Item"},
@ -88,8 +98,5 @@ CUIConfig *CFDStructDataSolverTimeModeManager::genUnsteadyModeUIConfig()
{"type", "LineEdit"},
{"name", "mcyc"}
})
});
}

@ -2,10 +2,10 @@
#define CFDSTRUCTDATASOLVERTIMEMODEMANAGER_H
#include <QObject>
#include "CFDStructDataManager_global.h"
class CUIConfig;
class CFDStructDataSolverTimeModeManager : public QObject
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverTimeModeManager : public QObject
{
Q_OBJECT
public:
@ -34,7 +34,7 @@ private:
// 鏃跺潎缁熻閲忔暟鎹噰鏍0,1
int m_timeaverage = 0;
CUIConfig* m_uiConfig;
CUIConfig* m_uiConfig = nullptr;
};
#endif // CFDSTRUCTDATASOLVERTIMEMODEMANAGER_H

@ -37,6 +37,7 @@ win32{
-lFITKCore \
-lOperatorsInterface \
-lFITKInterfaceGeometry \
-lCFDStructDataManager \
Debug:CONFIG += console
@ -56,6 +57,7 @@ win32{
-lFITKCore \
-lOperatorsInterface \
-lFITKInterfaceGeometry \
-lCFDStructDataManager \
Debug:LIBS += -L$$PWD/../../Tools/Win64/SARibbon/libd/ \
-lSARibbonBard \

@ -35,68 +35,56 @@
using namespace GUI;
CFDStructMainWindow::CFDStructMainWindow() {
CFDStructMainWindow::CFDStructMainWindow()
{
qDebug() << "new Empty CFDStructMainWindow";
initMainWindowMenu();
initCentralWidget();
initPropertyWidget();
setWindowTitle("AreoFlow");
}
void CFDStructMainWindow::initCentralWidget()
{
// 子部件水平排布
QSplitter* spliterLayout = new QSplitter(Qt::Horizontal);
spliterLayout->setMouseTracking(true);
spliterLayout->setHandleWidth(5);
int mainWindSize = QMainWindow::width();
// 子部件水平排布
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);
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() {
void CFDStructMainWindow::initPropertyWidget()
{
//CUI* cuiWidget = new CUI(new CUIConfig({
// "type", "Widget",
// "name", "main_widget"
@ -108,12 +96,9 @@ void CFDStructMainWindow::initPropertyWidget() {
// 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());
@ -122,82 +107,71 @@ void CFDStructMainWindow::initPropertyWidget() {
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);
CUI* cui = new CUI(new CUIConfig({
{"type", "Widget"}
}, {
new CUIConfig({
{"type", "GroupBox"},
{"name", "GroupBox_name"}
}, {})
}));
// CUI* 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());
// cuilayout->addWidget(cui->getUI());
m_PropertyWidget->setWidget(cuiwidget);
}
void CFDStructMainWindow::initMainWindowMenu() {
void CFDStructMainWindow::initMainWindowMenu()
{
initApplicationButton();
addSARibbonCategoryGeometry();
addSARibbonCategoryMesh();
addSARibbonCategoryCalculation();
addSARibbonCategoryPostProcessing();
addSARibbonCategoryTool();
addSARibbonCategoryCivilAircraftTemplateLibrary();
_ribbonBar->setCurrentIndex(0);
}
void CFDStructMainWindow::addSARibbonCategoryGeometry() {
void CFDStructMainWindow::addSARibbonCategoryGeometry()
{
QString type = tr("Geometry");
SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type);
_ribbonBar->raiseCategory(gategory);
}
void CFDStructMainWindow::addSARibbonCategoryMesh() {
void CFDStructMainWindow::addSARibbonCategoryMesh()
{
QString type = tr("Mesh");
SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type);
_ribbonBar->raiseCategory(gategory);
}
void CFDStructMainWindow::addSARibbonCategoryCalculation() {
void CFDStructMainWindow::addSARibbonCategoryCalculation()
{
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>µı<C2B5>ǩ
QString type = tr("Calculation");
SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type);
_ribbonBar->raiseCategory(gategory);
QAction* action = nullptr;
//pannel <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
SARibbonPannel* pannel = gategory->addPannel(tr("Simulation Run"));
//action = getAction("actionImportGeometry");
@ -205,7 +179,6 @@ void CFDStructMainWindow::addSARibbonCategoryCalculation() {
action = createAction(tr("Start Calculation"), "actionStartCalculation", ":/icons/createbox.png", tr("Start Calculation"));
//<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>С
pannelAddAction(pannel, action, SARibbonPannelItem::Large);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>"
pannel = gategory->addPannel(tr("Import and Export"));
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
@ -216,7 +189,6 @@ void CFDStructMainWindow::addSARibbonCategoryCalculation() {
action = createAction(tr("Import"), "actionImport", ":/icons/createsphere.png", tr("Import"));
//"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>"
pannelAddAction(pannel, action, SARibbonPannelItem::Large);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
pannel = gategory->addPannel(tr("Solver Settings"));
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> ʱ<><CAB1>ģʽ
@ -234,8 +206,7 @@ void CFDStructMainWindow::addSARibbonCategoryCalculation() {
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> <20>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD>
action = createAction(tr("Motion Properties"), "actionMotionProperties", ":/icons/BoolCommon.png", tr("Motion Properties"));
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22>߽<EFBFBD><DFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>"
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22>߽<EFBFBD><DFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>"
pannel = gategory->addPannel(tr("Boundary Conditions and Initial Conditions"));
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> <20>߽<EFBFBD><DFBD><EFBFBD><EFBFBD><EFBFBD>
action = createAction(tr("Boundary Conditions"), "actionBoundaryConditions", ":/icons/BoolCommon.png", tr("Boundary Conditions"));
@ -247,13 +218,13 @@ void CFDStructMainWindow::addSARibbonCategoryCalculation() {
action = createAction(tr("Initialization"), "actionInitialization", ":/icons/BoolCommon.png", tr("Initialization"));
pannelAddAction(pannel, action, SARibbonPannelItem::Large);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
pannel = gategory->addPannel(tr("Computational Control"));
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
action = createAction(tr("Computational Control"), "actionComputational Control", ":/icons/Computational Control.png", tr("Computational Control"));
pannelAddAction(pannel, action, SARibbonPannelItem::Large);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD>"
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD>"
pannel = gategory->addPannel(tr("Monitors"));
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> <20>в<EFBFBD>
action = createAction(tr("Residuals"), "actionResiduals", ":/icons/Residuals.png", tr("Residuals"));
@ -267,19 +238,22 @@ void CFDStructMainWindow::addSARibbonCategoryCalculation() {
}
void CFDStructMainWindow::addSARibbonCategoryPostProcessing() {
QString type = tr("Post Processing");
QString type = tr("Post Processing");
SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type);
_ribbonBar->raiseCategory(gategory);
}
void CFDStructMainWindow::addSARibbonCategoryTool() {
QString type = tr("Tool");
QString type = tr("Tool");
SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type);
_ribbonBar->raiseCategory(gategory);
}
void CFDStructMainWindow::addSARibbonCategoryCivilAircraftTemplateLibrary() {
QString type = tr("CivilAircraft Template sLibrary");
QString type = tr("CivilAircraft Template sLibrary");
SARibbonCategory* gategory = _ribbonBar->addCategoryPage(type);
_ribbonBar->raiseCategory(gategory);
}

@ -32,10 +32,12 @@
#include <FITK_Kernel/FITKCore/FITKOperatorRepo.h>
#include <FITK_Kernel/FITKCore/FITKActionOperator.h>
namespace GUI {
namespace GUI
{
CFDTreeWidget::CFDTreeWidget(QWidget* parent, PropertyWidget* m_PropertyWidget):
TreeWidget(parent) {
TreeWidget(parent)
{
this->m_PropertyWidget = m_PropertyWidget;
//右键 不可少否则右键无反应
setContextMenuPolicy(Qt::CustomContextMenu);
@ -44,160 +46,134 @@ namespace GUI {
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onModelCustomContextMenu(QPoint)));
}
void CFDTreeWidget::updateTree(QString s) {
void CFDTreeWidget::updateTree(QString s)
{
this->clear();
if (s == "SolutionAnalysis") {
addTreeSolutionAnalysis();
} else if (s == "Postprocessing") {
addTreePostprocessing();
} else if (s == "Preprocessing") {
addTreePreprocessing();
}
setItemsExpandable(true);
expandAll();
}
void CFDTreeWidget::addTreePreprocessing() {
void CFDTreeWidget::addTreePreprocessing()
{
QTreeWidgetItem* GeometryAndMeshingItem = new QTreeWidgetItem();
GeometryAndMeshingItem->setText(0,tr("Preprocessing"));
GeometryAndMeshingItem->setData(1,0,-1);
GeometryAndMeshingItem->setText(0, tr("Preprocessing"));
GeometryAndMeshingItem->setData(1, 0, -1);
// GeometryAndMeshingItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_GeometryandMeshing));
this->addTopLevelItem(GeometryAndMeshingItem);
}
void CFDTreeWidget::addTreeSolutionAnalysis() {
void CFDTreeWidget::addTreeSolutionAnalysis()
{
QTreeWidgetItem* GeometryAndMeshingItem = new QTreeWidgetItem();
GeometryAndMeshingItem->setText(0,tr("Geometry and Meshing"));
GeometryAndMeshingItem->setData(1,0,-1);
GeometryAndMeshingItem->setText(0, tr("Geometry and Meshing"));
GeometryAndMeshingItem->setData(1, 0, -1);
GeometryAndMeshingItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_GeometryandMeshing));
this->addTopLevelItem(GeometryAndMeshingItem);
QTreeWidgetItem* mesh = new QTreeWidgetItem();
mesh->setText(0,tr("Mesh001"));
mesh->setData(1,0,-1);
mesh->setText(0, tr("Mesh001"));
mesh->setData(1, 0, -1);
// mesh->setdata(2,0,QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::))
GeometryAndMeshingItem->addChild(mesh);
QTreeWidgetItem* ComputationalSetupItem = new QTreeWidgetItem();
ComputationalSetupItem->setText(0,tr("Computational Setup"));
ComputationalSetupItem->setData(1,0,-1);
ComputationalSetupItem->setText(0, tr("Computational Setup"));
ComputationalSetupItem->setData(1, 0, -1);
ComputationalSetupItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetup));
this->addTopLevelItem(ComputationalSetupItem);
QTreeWidgetItem* TimeModeItem = new QTreeWidgetItem();
TimeModeItem->setText(0,tr("Time Mode"));
TimeModeItem->setData(1,0,-1);
TimeModeItem->setText(0, tr("Time Mode"));
TimeModeItem->setData(1, 0, -1);
TimeModeItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupTimeMode));
ComputationalSetupItem->addChild(TimeModeItem);
QTreeWidgetItem* ComputationalDomainItem = new QTreeWidgetItem();
ComputationalDomainItem->setText(0,tr("Computational Domain"));
ComputationalDomainItem->setData(1,0,-1);
ComputationalDomainItem->setText(0, tr("Computational Domain"));
ComputationalDomainItem->setData(1, 0, -1);
ComputationalDomainItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomain));
ComputationalSetupItem->addChild(ComputationalDomainItem);
QTreeWidgetItem* SolverItem = new QTreeWidgetItem();
SolverItem->setText(0,tr("Solver"));
SolverItem->setData(1,0,-1);
SolverItem->setText(0, tr("Solver"));
SolverItem->setData(1, 0, -1);
SolverItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolver));
ComputationalDomainItem->addChild(SolverItem);
QTreeWidgetItem* BasicModelItem = new QTreeWidgetItem();
BasicModelItem->setText(0,tr("Basic Model"));
BasicModelItem->setData(1,0,-1);
BasicModelItem->setText(0, tr("Basic Model"));
BasicModelItem->setData(1, 0, -1);
BasicModelItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBasicModel));
SolverItem->addChild(BasicModelItem);
QTreeWidgetItem* ViscosityModelItem = new QTreeWidgetItem();
ViscosityModelItem->setText(0,tr("Viscosity Model"));
ViscosityModelItem->setData(1,0,-1);
ViscosityModelItem->setText(0, tr("Viscosity Model"));
ViscosityModelItem->setData(1, 0, -1);
ViscosityModelItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverViscosityModel));
SolverItem->addChild(ViscosityModelItem);
QTreeWidgetItem* NumericalMethodsItem = new QTreeWidgetItem();
NumericalMethodsItem->setText(0,tr("Numerical Methods"));
NumericalMethodsItem->setData(1,0,-1);
NumericalMethodsItem->setText(0, tr("Numerical Methods"));
NumericalMethodsItem->setData(1, 0, -1);
NumericalMethodsItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverNumericalMethods));
SolverItem->addChild(NumericalMethodsItem);
QTreeWidgetItem* MotionPropertiesItem = new QTreeWidgetItem();
MotionPropertiesItem->setText(0,tr("Motion Properties"));
MotionPropertiesItem->setData(1,0,-1);
MotionPropertiesItem->setText(0, tr("Motion Properties"));
MotionPropertiesItem->setData(1, 0, -1);
MotionPropertiesItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMotionProperties));
ComputationalDomainItem->addChild(MotionPropertiesItem);
QTreeWidgetItem* motion1Item = new QTreeWidgetItem();
motion1Item->setText(0, tr("motion-1"));
motion1Item->setData(1, 0, -1);
MotionPropertiesItem->addChild(motion1Item);
QTreeWidgetItem* BoundaryConditionsItem = new QTreeWidgetItem();
BoundaryConditionsItem->setText(0,tr("Boundary Conditions"));
BoundaryConditionsItem->setData(1,0,-1);
BoundaryConditionsItem->setText(0, tr("Boundary Conditions"));
BoundaryConditionsItem->setData(1, 0, -1);
BoundaryConditionsItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBoundaryConditions));
ComputationalDomainItem->addChild(BoundaryConditionsItem);
QTreeWidgetItem* pressureinletItem = new QTreeWidgetItem();
pressureinletItem->setText(0,tr("Pressure-Inlet"));
pressureinletItem->setData(1,0,-1);
pressureinletItem->setText(0, tr("Pressure-Inlet"));
pressureinletItem->setData(1, 0, -1);
pressureinletItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBoundaryConditionsPressureInlet));
BoundaryConditionsItem->addChild(pressureinletItem);
QTreeWidgetItem* InitializationItem = new QTreeWidgetItem();
InitializationItem->setText(0,tr("Initialization"));
InitializationItem->setData(1,0,-1);
InitializationItem->setText(0, tr("Initialization"));
InitializationItem->setData(1, 0, -1);
InitializationItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverInitialization));
ComputationalDomainItem->addChild(InitializationItem);
QTreeWidgetItem* ComputationalControlItem = new QTreeWidgetItem();
ComputationalControlItem->setText(0,tr("Computational Control"));
ComputationalControlItem->setData(1,0,-1);
ComputationalControlItem->setText(0, tr("Computational Control"));
ComputationalControlItem->setData(1, 0, -1);
ComputationalControlItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControl));
ComputationalDomainItem->addChild(ComputationalControlItem);
QTreeWidgetItem* ReferenceQuantityItem = new QTreeWidgetItem();
ReferenceQuantityItem->setText(0,tr("Reference Quantity"));
ReferenceQuantityItem->setData(1,0,-1);
ReferenceQuantityItem->setText(0, tr("Reference Quantity"));
ReferenceQuantityItem->setData(1, 0, -1);
ReferenceQuantityItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControlReferenceQuantity));
ComputationalControlItem->addChild(ReferenceQuantityItem);
QTreeWidgetItem* MonitorsItem = new QTreeWidgetItem();
MonitorsItem->setText(0,tr("Monitors"));
MonitorsItem->setData(1,0,-1);
MonitorsItem->setText(0, tr("Monitors"));
MonitorsItem->setData(1, 0, -1);
MonitorsItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitors));
ComputationalDomainItem->addChild(MonitorsItem);
QTreeWidgetItem* ResidualItem = new QTreeWidgetItem();
ResidualItem->setText(0,tr("Residual"));
ResidualItem->setData(1,0,-1);
ResidualItem->setText(0, tr("Residual"));
ResidualItem->setData(1, 0, -1);
ResidualItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsResidual));
MonitorsItem->addChild(ResidualItem);
QTreeWidgetItem* AerodynamicForceItem = new QTreeWidgetItem();
AerodynamicForceItem->setText(0,tr("Aerodynamic Force"));
AerodynamicForceItem->setData(1,0,-1);
AerodynamicForceItem->setText(0, tr("Aerodynamic Force"));
AerodynamicForceItem->setData(1, 0, -1);
AerodynamicForceItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsAerodynamicForce));
MonitorsItem->addChild(AerodynamicForceItem);
QTreeWidgetItem* TurbomachineryPerformanceItem = new QTreeWidgetItem();
TurbomachineryPerformanceItem->setText(0,tr("Turbomachinery Performance"));
TurbomachineryPerformanceItem->setData(1,0,-1);
TurbomachineryPerformanceItem->setText(0, tr("Turbomachinery Performance"));
TurbomachineryPerformanceItem->setData(1, 0, -1);
TurbomachineryPerformanceItem->setData(2, 0, QVariant::fromValue(GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsTurbomachineryPerformance));
MonitorsItem->addChild(TurbomachineryPerformanceItem);
}
void CFDTreeWidget::addTreePostprocessing() {
void CFDTreeWidget::addTreePostprocessing()
{
// _treePostprocessing = new TreeWidget(this);
// tabWidget->addTab(_treePostprocessing,tr("Postprocessing"));
// qDebug()<<"!!!";
@ -242,43 +218,46 @@ namespace GUI {
void CFDTreeWidget::onItemClicked(QTreeWidgetItem *item, int column)
{
EventOper::TreeEventOperator* treeOper = Core::FITKOperatorRepo::getInstance()->getOperatorT<EventOper::TreeEventOperator>("ModelTreeEvent");
if (treeOper == nullptr) return;
if (treeOper == nullptr) {
return;
}
EventOper::GraphEventOperator* graphOper = FITKOPERREPO->getOperatorT<EventOper::GraphEventOperator>("GraphPreprocess");
if (graphOper == nullptr)return;
if (graphOper == nullptr) {
return;
}
graphOper->clearHighlight();
if (item == nullptr)return;
if (item == nullptr) {
return;
}
int objID = item->data(1, 0).toInt();
GUI::SolutionAnalysisTreeEnum treeType = item->data(2, 0).value<GUI::SolutionAnalysisTreeEnum>();
Interface::FITKGeoEnum::FITKGeometryComType geometryType = item->data(3, 0).value<Interface::FITKGeoEnum::FITKGeometryComType>();
QString name = "";
switch (treeType) {
case GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupTimeMode:name = "actionTimeModeEdit"; break;
case GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBasicModel:name = "actionBasicModelEdit"; break;
default:name = "";
case GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupTimeMode:
name = "actionTimeModeEdit";
break;
case GUI::SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBasicModel:
name = "actionBasicModelEdit";
break;
default:
name = "";
}
qDebug()<<name;
qDebug() << name;
if (!name.isEmpty()) {
QObject sender;
sender.setObjectName(name);
auto acOper = Core::FITKOperatorRepo::getInstance()->getOperatorT<Core::FITKActionOperator>(name);
if (acOper == nullptr){
if (acOper == nullptr) {
qDebug("acOper is nullptr");
return;
}
acOper->setEmitter(&sender);
acOper->setArgs("objID", objID);
acOper->actionTriggered();
}
else {
} else {
treeOper->moveProcessToStep(0);
}
}

@ -11,15 +11,17 @@
#include<CUIRadioButton.h>
#include<QDebug>
#include<CUIButtonBox.h>
#include<QVBoxLayout>
/**
* @brief CUI::CUI
* @param conf
*/
CUI::CUI(CUIConfig *conf)
CUI::CUI(QWidget *parent, CUIConfig *conf): QWidget(parent)
{
this->conf = conf;
this->conf->printConfig();
// this->conf->printConfig();
qDebug() << "----------------------";
buildUI();
}
@ -28,42 +30,37 @@ CUI::CUI(CUIConfig *conf)
*/
void CUI::buildUI()
{
// QString type = conf->property["type"];
QWidget* widget = nullptr;
QString type = conf->getPropertyValue("type");
if(type == "")
if(type == "") {
return;
if(type == "Widget")
{
uiWidget = new CUIWidget(conf,subCUI);
}
if(type == "GroupBox")
{
uiGroupBox = new CUIGroupBox(conf,subCUI);
}
if(type == "LineEdit")
{
uiLineEdit = new CUILineEdit(conf,subCUI);
}
if(type == "TabWidget")
{
uiTabWidget = new CUITabWidget(conf,subCUI);
}
if(type == "ComboBox"){
uiComboBox = new CUIComboBox(conf,subCUI);
}
if(type == "PushButton"){
uiPushButton = new CUIPushButton(conf,subCUI);
}
if(type == "CheckBox"){
uiCheckBox = new CUICheckBox(conf,subCUI);
}
if(type == "RadioButton"){
uiRadioButton = new CUIRadioButton(conf,subCUI);
}
if(type == "ButtonBox"){
uiButtonBox = new CUIButtonBox(conf,subCUI);
if(type == "Widget") {
widget = new CUIWidget(conf, subCUI);
} else if(type == "GroupBox") {
widget = new CUIGroupBox(conf, subCUI);
} else if(type == "LineEdit") {
widget = new CUILineEdit(conf, subCUI);
} else if(type == "TabWidget") {
widget = new CUITabWidget(conf, subCUI);
} else if(type == "ComboBox") {
widget = new CUIComboBox(conf, subCUI);
} else if(type == "PushButton") {
widget = new CUIPushButton(conf, subCUI);
} else if(type == "CheckBox") {
widget = new CUICheckBox(conf, subCUI);
} else if(type == "RadioButton") {
widget = new CUIRadioButton(conf, subCUI);
} else if(type == "ButtonBox") {
widget = new CUIButtonBox(conf, subCUI);
}
if (widget) {
qDebug() << "----------- ui widget is not null";
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(widget);
this->setLayout(layout);
} else {
qDebug() << "----------- ui widget is null";
}
}
@ -81,37 +78,42 @@ void CUI::check()
QWidget *CUI::getUI()
{
QString type = conf->getPropertyValue("type");
if(type == "Widget"){
if(type == "Item") {
return NULL;
} else {
return this;
}
return NULL;
if(type == "Widget") {
return uiWidget;
}
if(type == "GroupBox"){
if(type == "GroupBox") {
return uiGroupBox;
}
if(type == "LineEdit"){
if(type == "LineEdit") {
return uiLineEdit;
}
if(type == "TabWidget"){
if(type == "TabWidget") {
return uiTabWidget;
}
if(type == "ComboBox"){
if(type == "ComboBox") {
return uiComboBox;
}
if(type == "Item"){
if(type == "Item") {
return NULL;
}
if(type == "PushButton"){
if(type == "PushButton") {
return uiPushButton;
}
if(type == "CheckBox"){
if(type == "CheckBox") {
return uiCheckBox;
}
if(type == "ButtonBox"){
if(type == "ButtonBox") {
return uiButtonBox;
}
if(type == "RadioButton"){
if(type == "RadioButton") {
return uiRadioButton;
}
return NULL;
}
@ -144,14 +146,13 @@ qint32 CUI::getMaxLabelWidth()
{
qint32 res = INT_MIN;
QString type = conf->getPropertyValue("type");
if(type == "LineEdit"){
if(type == "LineEdit") {
res = uiLineEdit->getLabelWidth();
}
else if(type == "ComboBox"){
} else if(type == "ComboBox") {
res = uiComboBox->getLabelWidth();
}else{
for(auto &ui:subCUI){
res = qMax(res,ui->getMaxLabelWidth());
} else {
for(auto &ui : subCUI) {
res = qMax(res, ui->getMaxLabelWidth());
}
}
return res;
@ -160,13 +161,12 @@ qint32 CUI::getMaxLabelWidth()
void CUI::setLabelWidth(qint32 width)
{
QString type = conf->getPropertyValue("type");
if(type == "LineEdit"){
if(type == "LineEdit") {
uiLineEdit->setLabelWidth(width);
}
else if(type == "ComboBox"){
} else if(type == "ComboBox") {
uiComboBox->setLabelWidth(width);
}else{
for(auto &ui:subCUI){
} else {
for(auto &ui : subCUI) {
ui->setLabelWidth(width);
}
}

@ -3,6 +3,8 @@
#include<QtGlobal>
#include<QSet>
#include<QWidget>
#include "CUIPropertyAPI.h"
class CUIConfig;
class QWidget;
class CUIWidget;
@ -19,10 +21,12 @@ class CUIButtonBox;
/**
* @brief The CUI class ,config
*/
class CUI
class CUIPropertyAPI CUI: public QWidget
{
Q_OBJECT
public:
CUI(CUIConfig* conf);
CUI(QWidget* parent = nullptr, CUIConfig* conf = nullptr);
// CUI(CUIConfig* conf);
void buildUI();
void check();
QWidget* getUI();
@ -44,7 +48,7 @@ private:
QVector<CUI*> subCUI;
const QSet<QString> haveLabelType = {"LineEdit","ComboBox"};
const QSet<QString> haveLabelType = {"LineEdit", "ComboBox"};
qint32 getMaxLabelWidth();
void setLabelWidth(qint32 width);
};

@ -6,6 +6,7 @@
#include<QLabel>
#include<QDebug>
#include<QAbstractItemView>
#include "CFDStructDataManager/CFDStructDataDefine.h"
/**
* @brief CUIComboBox::CUIComboBox
@ -49,18 +50,16 @@ void CUIComboBox::iniUI(QVector<CUI*> &subCUI)
this->setLayout(layout);
layout->addWidget(label);
layout->addWidget(comboBox);
// layout->setStretchFactor(label,1);
layout->setStretchFactor(comboBox,1);
layout->setStretchFactor(comboBox, 1);
// comboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
// comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
// label->setMinimumWidth(114);
qDebug()<<label->minimumSizeHint()<<" combobox";
qDebug() << label->minimumSizeHint() << " combobox";
iniComoboBox();
connect(comboBox,QOverload<int>::of(&QComboBox::activated),[=](int idx){
qDebug()<<comboBox->itemData(idx);
connect(comboBox, QOverload<int>::of(&QComboBox::activated), [ = ](int idx) {
qDebug() << comboBox->itemData(idx);
this->conf->setValue(idx);
});
}
@ -69,22 +68,23 @@ void CUIComboBox::iniUI(QVector<CUI*> &subCUI)
*/
void CUIComboBox::iniComoboBox()
{
for(auto cui:conf->getSub()){
for(auto cui : conf->getSub()) {
QString type = cui->getPropertyValue("type");
if(type != "Item"){
qDebug()<<"wrong type!!!";
if(type != "Item") {
qDebug() << "wrong type!!!";
return;
}
CUI* temp = new CUI(cui);
CUI* temp = new CUI(nullptr, cui);
Items.push_back(temp);
if(temp->getProperty("data_type") == "int")
comboBox->addItem(temp->getProperty("name"),temp->getProperty("data").toInt());
else if(temp->getProperty("data_type") == "double")
comboBox->addItem(temp->getProperty("name"),temp->getProperty("data").toDouble());
else
comboBox->addItem(temp->getProperty("name"),temp->getProperty("data"));
if(temp->getProperty("data_type") == "int") {
comboBox->addItem(temp->getProperty("name"), temp->getProperty("data").toInt());
} else if(temp->getProperty("data_type") == "double") {
comboBox->addItem(temp->getProperty("name"), temp->getProperty("data").toDouble());
} else {
comboBox->addItem(temp->getProperty("name"), temp->getProperty("data"));
}
}
QVariant vOrigin = conf->getPropertyOriginValue("valueOrigin");
int *ptr = qvariant_cast<int *>(vOrigin);
comboBox->setCurrentIndex(*ptr);
}

@ -1,6 +1,8 @@
#include "CUIConfig.h"
#include <QDebug>
#include "CFDStructDataManager/CFDStructDataDefine.h"
#include "CFDStructDataManager/CFDStructSigsCenter.h"
#include <QTimer>
/**
* @brief CUIConfig::CUIConfig
@ -95,9 +97,13 @@ void CUIConfig::setValue(QVariant value)
{
// TODO
QVariant pValue = property["valueOrigin"];
if (property["valueType"] == "int") {
if (property["valueType"] == "Int") {
int* ptr = qvariant_cast<int*>(pValue);
// if (*ptr != value.toInt()) {
*ptr = value.toInt();
// TODO通知参数值发生修改
QTimer::singleShot(200, CFDStructSigsCenter::getInstance(), &CFDStructSigsCenter::sig_solverTimeModeDataChanged);
// }
}
}

@ -1,11 +1,12 @@
#ifndef CUICONFIG_H
#define CUICONFIG_H
#include<QString>
#include<QMap>
#include<QVariant>
#include <QString>
#include <QMap>
#include <QVariant>
#include "CUIPropertyAPI.h"
class CUIConfig
class CUIPropertyAPI CUIConfig
{
public:
CUIConfig(QMap<QString, QVariant> temp);

@ -27,11 +27,9 @@ void CUIGroupBox::iniUI(QVector<CUI*> &subCUI)
// appLayout();
layout = appLayout(conf);
this->setLayout(layout);
qDebug()<<this->conf->getSub().size();
for(auto conf : this->conf->getSub()){
CUI* tmp = new CUI(conf);
qDebug() << this->conf->getSub().size();
for(auto conf : this->conf->getSub()) {
CUI* tmp = new CUI(nullptr, conf);
subCUI.push_back(tmp);
layout->addWidget(tmp->getUI());
}

@ -2,13 +2,14 @@
#define CUILINEEDIT_H
#include <QLineEdit>
#include "CUIPropertyAPI.h"
class CUIConfig;
class QLabel;
class QHBoxLayout;
class CUI;
class CUILineEdit : public QWidget
class CUIPropertyAPI CUILineEdit : public QWidget
{
Q_OBJECT
public:

@ -20,9 +20,9 @@ CUITabWidget::CUITabWidget(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *pare
*/
void CUITabWidget::iniUI(QVector<CUI*> &subCUI)
{
for(auto conf:conf->getSub()){
CUI* subui = new CUI(conf);
for(auto conf : conf->getSub()) {
CUI* subui = new CUI(nullptr, conf);
subCUI.push_back(subui);
this->addTab(subui->getUI(),conf->getPropertyValue("name"));
this->addTab(subui->getUI(), conf->getPropertyValue("name"));
}
}

@ -12,7 +12,7 @@
* @param conf
* @param parent
*/
CUIWidget::CUIWidget(CUIConfig *conf,QVector<CUI*> &subCUI, QWidget *parent):QWidget(parent)
CUIWidget::CUIWidget(CUIConfig *conf, QVector<CUI*> &subCUI, QWidget *parent): QWidget(parent)
{
this->conf = conf;
iniUI(subCUI);
@ -25,11 +25,9 @@ void CUIWidget::iniUI(QVector<CUI*> &subCUI)
{
layout = appLayout(conf);
this->setLayout(layout);
// qDebug()<<"widget add layout";
for(auto &conf : this->conf->getSub()){
CUI* tmp = new CUI(conf);
for(auto &conf : this->conf->getSub()) {
CUI* tmp = new CUI(nullptr, conf);
subCUI.push_back(tmp);
layout->addWidget(tmp->getUI());
}

Loading…
Cancel
Save