diff --git a/CFDStruct/CFDOperatorsModel/CFDOperatorsTimeModeManager.cpp b/CFDStruct/CFDOperatorsModel/CFDOperatorsTimeModeManager.cpp index 249e3fd..e742468 100644 --- a/CFDStruct/CFDOperatorsModel/CFDOperatorsTimeModeManager.cpp +++ b/CFDStruct/CFDOperatorsModel/CFDOperatorsTimeModeManager.cpp @@ -15,8 +15,7 @@ namespace ModelOper { CFDOperatorsTimeModeManager::CFDOperatorsTimeModeManager() { - qDebug()<<"build Time Mode Manager"; - + qDebug() << "build Time Mode Manager"; } CFDOperatorsTimeModeManager::~CFDOperatorsTimeModeManager() @@ -26,12 +25,14 @@ namespace ModelOper bool CFDOperatorsTimeModeManager::execGUI() { QWidget* widget = nullptr; - GUI::MainWindow* mainWindow = dynamic_cast(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,41 +40,39 @@ namespace ModelOper // break; // } // } - - qDebug()<<"Time Mode Manager11111111111"; + 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"} - },{}) - })); + {"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) { - propertyWidget->setWidget(widget); + propertyWidget->setWidget(widget); // } - return false; } bool CFDOperatorsTimeModeManager::execProfession() { - return true; + return true; } } diff --git a/CFDStruct/CFDOperatorsModel/CFDOperatorsTimeModeManager.h b/CFDStruct/CFDOperatorsModel/CFDOperatorsTimeModeManager.h index 8468463..5c47b11 100644 --- a/CFDStruct/CFDOperatorsModel/CFDOperatorsTimeModeManager.h +++ b/CFDStruct/CFDOperatorsModel/CFDOperatorsTimeModeManager.h @@ -5,13 +5,11 @@ #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 */ @@ -36,6 +34,7 @@ namespace ModelOper // 按钮注册相关操作 Register2FITKOPeratorRepo(actionTimeModeEdit, CFDOperatorsTimeModeManager); + Register2FITKOPeratorRepo(actionBasicModelEdit, CFDOperatorsTimeModeManager); } #endif diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp index 62f08d3..f9dcc51 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp @@ -1,5 +1,5 @@ #include "CFDStructDataManager.h" -CFDStructDataManager::CFDStructDataManager() -{ +CFDStructDataManager::CFDStructDataManager() { + m_pTimeMode = new CFDStructDataTimeMode; } diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataManager.h index 5eac5e8..1c5b4c1 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataManager.h @@ -3,10 +3,20 @@ #include "CFDStructDataManager_global.h" -class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataManager -{ -public: +class CFDStructDataTimeModeUIConfig { + +}; + +class CFDStructDataTimeMode { + int mode = 0; + int step = 5000; +}; + +class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataManager { + public: CFDStructDataManager(); + private: + CFDStructDataTimeMode* m_pTimeMode; }; #endif // CFDSTRUCTDATAMANAGER_H diff --git a/CFDStruct/CUIProperty/CUIConfig.cpp b/CFDStruct/CUIProperty/CUIConfig.cpp index fbd785f..9098d97 100644 --- a/CFDStruct/CUIProperty/CUIConfig.cpp +++ b/CFDStruct/CUIProperty/CUIConfig.cpp @@ -1,16 +1,15 @@ #include "CUIConfig.h" - #include +#include "CFDStructDataManager/CFDStructDataDefine.h" /** * @brief CUIConfig::CUIConfig 构造函数 * @param property 组件的属性 */ -CUIConfig::CUIConfig(QMap property) +CUIConfig::CUIConfig(QMap property) { - this->property = property; - setDefault(); + this->property = property; } /** @@ -70,12 +69,11 @@ CUIConfig::CUIConfig(QMap property) * @param property 组件的属性 * @param sub 该组件的子组件配置的列表 */ -CUIConfig::CUIConfig(QMap property, QVector sub) +CUIConfig::CUIConfig(QMap property, QVector sub) { + setDefault(); this->property = property; this->sub = sub; - - setDefault(); } /** @@ -83,13 +81,40 @@ CUIConfig::CUIConfig(QMap property, QVector sub) */ void CUIConfig::printConfig() { - qDebug()<<"{"; - for(auto it = property.begin();it!=property.end();it++) - qDebug()<printConfig(); - qDebug()<<"}"; + } + qDebug() << "}"; +} +void CUIConfig::setValue(QVariant value) +{ + // TODO + QVariant pValue = property["valueOrigin"]; + if (property["valueType"] == "int") { + int* ptr = qvariant_cast(pValue); + *ptr = value.toInt(); + } +} + +QString CUIConfig::getPropertyValue(QString key) +{ + if(property.contains(key)) { + return QVA_FROM_QS(property[key]); + } + return QString(); +} + +QVariant CUIConfig::getPropertyOriginValue(QString key) +{ + if(property.contains(key)) { + return property[key]; + } + return QVariant::Invalid; } @@ -98,34 +123,29 @@ void CUIConfig::printConfig() */ void CUIConfig::setDefault() { - if(property["type"] == "LineEdit"){ - setDefault("name",""); - setDefault("data_type","string");//数据类型 - setDefault("initial_value_","");//初始值 - setDefault("check_range_","false");//是否检查范围 - setDefault("range_min_","");//最小值 - setDefault("range_max_","");//最大值 - setDefault("inclusive_","true");//范围是否包括 - setDefault("required_","false");//是否为必选 - } - if(property["type"] == "Widget"){ - setDefault("layout","QVBoxLayout"); - setDefault("name",""); - } - if(property["type"] == "GroupBox"){ - setDefault("name",""); - setDefault("layout","QVBoxLayout"); - } - if(property["type"] == "TabWidget"){ - - } - if(property["type"] == "ComboBox"){ - setDefault("name",""); - } - if(property["type"] == "Item"){ - setDefault("name",""); - setDefault("data_type","string"); - setDefault("data",""); + QString type = QVA_FROM_QS(property["type"]); + if(type == "LineEdit") { + setDefault("name", ""); + setDefault("data_type", "string"); //数据类型 + setDefault("initial_value_", ""); //初始值 + setDefault("check_range_", "false"); //是否检查范围 + setDefault("range_min_", ""); //最小值 + setDefault("range_max_", ""); //最大值 + setDefault("inclusive_", "true"); //范围是否包括 + setDefault("required_", "false"); //是否为必选 + } else if(type == "Widget") { + setDefault("layout", "QVBoxLayout"); + setDefault("name", ""); + } else if(type == "GroupBox") { + setDefault("name", ""); + setDefault("layout", "QVBoxLayout"); + } else if(type == "TabWidget") { + } else if(type == "ComboBox") { + setDefault("name", ""); + } else if(type == "Item") { + setDefault("name", ""); + setDefault("data_type", "string"); + setDefault("data", ""); } } @@ -135,9 +155,10 @@ void CUIConfig::setDefault() * @param key * @param val */ -void CUIConfig::setDefault(QString key, QString val) +void CUIConfig::setDefault(QString key, QVariant val) { - if(!property.contains(key)) + if(!property.contains(key)) { property[key] = val; + } } diff --git a/CFDStruct/CUIProperty/CUIConfig.h b/CFDStruct/CUIProperty/CUIConfig.h index e2dbf92..7daa6c3 100644 --- a/CFDStruct/CUIProperty/CUIConfig.h +++ b/CFDStruct/CUIProperty/CUIConfig.h @@ -3,22 +3,26 @@ #include #include +#include class CUIConfig { public: - CUIConfig(QMap property); - CUIConfig(QMap property,QVector sub); + CUIConfig(QMap temp); + CUIConfig(QMap temp, QVector sub); void printConfig(); - QMap property; - QVector sub; - static int labelMinWidth; + void setValue(QVariant); + QString getPropertyValue(QString); + QVariant getPropertyOriginValue(QString); private: -// QString p; void setDefault(); - void setDefault(QString key,QString val); + void setDefault(QString key, QVariant val); +private: + QMap property; + QVector sub; + static int labelMinWidth; }; #endif // CUICONFIG_H diff --git a/FITK_Kernel/FITKCore/FITKOperatorRepo.h b/FITK_Kernel/FITKCore/FITKOperatorRepo.h index 11eccec..8d976e3 100644 --- a/FITK_Kernel/FITKCore/FITKOperatorRepo.h +++ b/FITK_Kernel/FITKCore/FITKOperatorRepo.h @@ -16,9 +16,9 @@ #include #include #include +#include -namespace Core -{ +namespace Core { class FITKAbstractOperator; class FITKOperatorRepoPrivate; class FITKOperatorDeletor; @@ -28,8 +28,7 @@ namespace Core * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-03-04 */ - class FITKCoreAPI FITKOperatorRepo : public FITKAbstractObject - { + class FITKCoreAPI FITKOperatorRepo : public FITKAbstractObject { friend FITKOperatorDeletor; //声明为单例 DeclSingleton(FITKOperatorRepo); @@ -50,12 +49,11 @@ namespace Core * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-03-04 */ - T* getOperatorT(const QString& key) - { + T* getOperatorT(const QString& key) { return dynamic_cast (this->getOperator(key)); } - private: + private: /** * @brief 初始化 * @author LiBaojun (libaojunqd@foxmail.com) @@ -69,7 +67,7 @@ namespace Core */ void finalize(); - private: + private: /** * @brief 注册进来的创建operator函数 * @author LiBaojun (libaojunqd@foxmail.com) @@ -84,21 +82,20 @@ namespace Core FITKOperatorRepoPrivate* _private{}; - public: + public: template < typename T > /** * @brief 注册器 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-03-03 */ - class FITKOperatorRepoRegHelper - { - public: - FITKOperatorRepoRegHelper(QString key) - { + class FITKOperatorRepoRegHelper { + public: + FITKOperatorRepoRegHelper(QString key) { auto ins = FITKOperatorRepo::getInstance(); + qDebug() << key; // 注册构造函数,T类型必须有默认的无参构造函数 - ins->_createFuns.insert( key,[&] { return new T; }); + ins->_createFuns.insert( key, [&] { return new T; }); } }; };