Merge branch 'feature/struct-menu-20241023' of http://1.92.128.200:3000/YXS/AppFlow into feature/struct-menu-20241023

# Conflicts:
#	CFDStruct/CFDStructDataManager/CFDStructDataManager.pro
feature/struct-menu-20241023
mzh 3 weeks ago
commit 379d11c800

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

@ -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

@ -1,5 +1,5 @@
#include "CFDStructDataManager.h"
CFDStructDataManager::CFDStructDataManager()
{
CFDStructDataManager::CFDStructDataManager() {
m_pTimeMode = new CFDStructDataTimeMode;
}

@ -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

@ -1,16 +1,15 @@
#include "CUIConfig.h"
#include <QDebug>
#include "CFDStructDataManager/CFDStructDataDefine.h"
/**
* @brief CUIConfig::CUIConfig
* @param property
*/
CUIConfig::CUIConfig(QMap<QString, QString> property)
CUIConfig::CUIConfig(QMap<QString, QVariant> property)
{
this->property = property;
setDefault();
this->property = property;
}
/**
@ -70,12 +69,11 @@ CUIConfig::CUIConfig(QMap<QString, QString> property)
* @param property
* @param sub
*/
CUIConfig::CUIConfig(QMap<QString, QString> property, QVector<CUIConfig *> sub)
CUIConfig::CUIConfig(QMap<QString, QVariant> property, QVector<CUIConfig *> sub)
{
setDefault();
this->property = property;
this->sub = sub;
setDefault();
}
/**
@ -83,13 +81,40 @@ CUIConfig::CUIConfig(QMap<QString, QString> property, QVector<CUIConfig *> sub)
*/
void CUIConfig::printConfig()
{
qDebug()<<"{";
for(auto it = property.begin();it!=property.end();it++)
qDebug()<<it.key()<<' '<<it.value();
for(auto it : sub)
qDebug() << "{";
for(auto it = property.begin(); it != property.end(); it++) {
qDebug() << it.key() << ' ' << it.value();
}
for(auto it : sub) {
it->printConfig();
qDebug()<<"}";
}
qDebug() << "}";
}
void CUIConfig::setValue(QVariant value)
{
// TODO
QVariant pValue = property["valueOrigin"];
if (property["valueType"] == "int") {
int* ptr = qvariant_cast<int*>(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;
}
}

@ -3,22 +3,26 @@
#include<QString>
#include<QMap>
#include<QVariant>
class CUIConfig
{
public:
CUIConfig(QMap<QString,QString> property);
CUIConfig(QMap<QString,QString> property,QVector<CUIConfig*> sub);
CUIConfig(QMap<QString, QVariant> temp);
CUIConfig(QMap<QString, QVariant> temp, QVector<CUIConfig*> sub);
void printConfig();
QMap<QString,QString> property;
QVector<CUIConfig*> 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<QString, QVariant> property;
QVector<CUIConfig*> sub;
static int labelMinWidth;
};
#endif // CUICONFIG_H

@ -16,9 +16,9 @@
#include <QHash>
#include <functional>
#include <QString>
#include <QDebug>
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<T*> (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; });
}
};
};

Loading…
Cancel
Save