1、为checkbox组件添加了connect

2、完成了基本模型ui的界面切换
feature/struct-menu-20241023
mzh 2 weeks ago
parent 70d1192f90
commit b5e34525c7

@ -1,5 +1,7 @@
#include "CFDStructDataSolverBasicModelManager.h" #include "CFDStructDataSolverBasicModelManager.h"
#include "CUIProperty/CUIConfig.h" #include "CUIProperty/CUIConfig.h"
#include "CFDStructMain/CFDStructDefine.h"
#include "CFDStructSigsCenter.h"
CFDStructDataSolverBasicModelManager::CFDStructDataSolverBasicModelManager(QObject *parent) : CFDStructDataManagerBase(parent) CFDStructDataSolverBasicModelManager::CFDStructDataSolverBasicModelManager(QObject *parent) : CFDStructDataManagerBase(parent)
{ {
@ -13,10 +15,19 @@ CFDStructDataSolverBasicModelManager::~CFDStructDataSolverBasicModelManager()
delete m_uiConfig; delete m_uiConfig;
m_uiConfig = nullptr; m_uiConfig = nullptr;
} }
connect(m_cuiSigsCenter, &CUISigsCenter::sig_cuiPropertyChanged, this, [=](int semaphore){
emit CFDStructSigsCenter::getInstance()->sig_solverTimeModeDataChanged();
});
} }
CUIConfig *CFDStructDataSolverBasicModelManager::getParamUIConfig() CUIConfig *CFDStructDataSolverBasicModelManager::getParamUIConfig()
{ {
qDebug()<<"m_FluidProperties: "<<m_FluidProperties;
if(m_FluidProperties == 0)
return this->genFluidPropertiesOffUIConfig();
if(m_FluidProperties == 1)
return this->genFluidPropertiesOnUIConfig();
return this->genFluidPropertiesOnUIConfig(); return this->genFluidPropertiesOnUIConfig();
} }
@ -40,7 +51,11 @@ CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOffUIConfig()
})}), })}),
new CUIConfig({// 下拉框:流动模型 new CUIConfig({// 下拉框:流动模型
{"type", "ComboBox"}, {"type", "ComboBox"},
{"name", tr("Flow Model")}}, {"name", tr("Flow Model")},
{"value_type",CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin",QVA_GLOBAL(&m_FlowModel)},
{"semaphore",1},
},
{new CUIConfig({// 选项:外流 {new CUIConfig({// 选项:外流
{"type", "Item"}, {"type", "Item"},
{"name", tr("Internal Flow")}}), {"name", tr("Internal Flow")}}),
@ -54,8 +69,12 @@ CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOffUIConfig()
{"type", "CheckBox"}, {"type", "CheckBox"},
{"name", tr("Overlay Network")}}), {"name", tr("Overlay Network")}}),
new CUIConfig({// 方形选择按钮:流体属性 new CUIConfig({// 方形选择按钮:流体属性
{"type", "CheckButton"}, {"type", "CheckBox"},
{"name", tr("Fluid Properties")}})}); {"name", tr("Fluid Properties")},
{"value_type",CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin",QVA_GLOBAL(&m_FluidProperties)},
{"semaphore",1},
})});
} }
CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOnUIConfig() CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOnUIConfig()
@ -85,10 +104,15 @@ CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOnUIConfig()
{"name", tr("Multistage Turbomachinery")}})}), {"name", tr("Multistage Turbomachinery")}})}),
new CUIConfig({// 方形勾选:重叠网络 new CUIConfig({// 方形勾选:重叠网络
{"type", "CheckBox"}, {"type", "CheckBox"},
{"name", tr("ichimr")}}), {"name", tr("Overlay Network")},
}),
new CUIConfig({// 圆形选择按钮:流体属性 new CUIConfig({// 圆形选择按钮:流体属性
{"type", "RadioButton"}, {"type", "CheckBox"},
{"name", tr("Fluid Properties")}}), {"name", tr("Fluid Properties")},
{"value_type",CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin",QVA_GLOBAL(&m_FluidProperties)},
{"semaphore",1},
}),
new CUIConfig({// 组,流体属性下的内容 new CUIConfig({// 组,流体属性下的内容
{"type", "GroupBox"}, {"type", "GroupBox"},
{"name", tr("Fluid Properties")}}, {"name", tr("Fluid Properties")}},

@ -31,10 +31,10 @@ private:
int m_FlowModel = 0; int m_FlowModel = 0;
//重叠网格:不勾选0;勾选1 //重叠网格:不勾选0;勾选1
bool m_OverlayNetwork = 0; int m_OverlayNetwork = 0;
//流体属性:关闭0;开启1 //流体属性:关闭0;开启1
bool m_FluidProperties = 0; int m_FluidProperties = 0;
//气体成分 //气体成分
QString m_GasComposition = ""; QString m_GasComposition = "";

@ -197,7 +197,7 @@ void CFDStructMainWindow::addSARibbonCategoryCalculation()
//"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>" //"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>"
pannelAddAction(pannel, action, SARibbonPannelItem::Large); pannelAddAction(pannel, action, SARibbonPannelItem::Large);
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>"<22><><EFBFBD><EFBFBD>" //<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>"<22><><EFBFBD><EFBFBD>"
action = createAction(tr("Import"), "actionImport", ":/icons/createsphere.png", tr("Import")); action = createAction(tr("Import"), "actionImport", ":/img/test1.png", tr("Import"));
//"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>" //"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>"
pannelAddAction(pannel, action, SARibbonPannelItem::Large); pannelAddAction(pannel, action, SARibbonPannelItem::Large);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"

@ -12,4 +12,16 @@ CUICheckBox::CUICheckBox(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent
void CUICheckBox::iniUI(QVector<CUI*> &subCUI) void CUICheckBox::iniUI(QVector<CUI*> &subCUI)
{ {
this->setText(conf->getPropertyValue("name")); this->setText(conf->getPropertyValue("name"));
QVariant vOrigin = conf->getPropertyOriginValue("value_origin");
int *ptr = qvariant_cast<int*>(vOrigin);
if(ptr!=nullptr){
if(*ptr == 1)
this->setCheckState(Qt::Checked);
}
connect(this, QOverload<bool>::of(&QCheckBox::clicked),[ = ](bool sign){
qDebug()<<"CheckBox is clicked"<<' '<<sign;
this->conf->setValue((int)sign);
});
} }

@ -99,10 +99,12 @@ void CUIConfig::printConfig()
void CUIConfig::setValue(QVariant value) void CUIConfig::setValue(QVariant value)
{ {
// qDebug()<<"setValue "<<value;
bool changed = false; bool changed = false;
QVariant pValue = property["value_origin"]; QVariant pValue = property["value_origin"];
if (property["value_type"] == CUI_DATA_TYPE_INT) { if (property["value_type"] == CUI_DATA_TYPE_INT) {
int* ptr = qvariant_cast<int*>(pValue); int* ptr = qvariant_cast<int*>(pValue);
qDebug()<<"value_type is int"<<ptr;
if (*ptr != value.toInt()) { if (*ptr != value.toInt()) {
*ptr = value.toInt(); *ptr = value.toInt();
changed = true; changed = true;

@ -240,6 +240,8 @@
<!-- APPFlowIcon --> <!-- APPFlowIcon -->
<file>./icons/icoR_license.svg</file> <file>./icons/icoR_license.svg</file>
<file>./img/createbox.png</file> <file>./img/createbox.png</file>
<file>./img/test1.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Loading…
Cancel
Save