Merge branch 'feature/struct-menu-20241023' of http://1.92.128.200:3000/YXS/AppFlow into feature/struct-menu-20241023
# Conflicts: # CFDStruct/CFDStructMain/CFDTreeWidget.cppfeature/struct-menu-20241023
commit
bc8a8863fa
@ -0,0 +1,19 @@
|
||||
#include "CFDStructDataManagerBase.h"
|
||||
|
||||
CFDStructDataManagerBase::CFDStructDataManagerBase(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_cuiSigsCenter = CUISigsCenter::getInstance();
|
||||
}
|
||||
|
||||
CFDStructDataManagerBase::~CFDStructDataManagerBase()
|
||||
{
|
||||
if (m_uiConfig != nullptr) {
|
||||
delete m_uiConfig;
|
||||
m_uiConfig = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
CUIConfig *CFDStructDataManagerBase::getParamUIConfig()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#ifndef CFDSTRUCTDATAMANAGERBASE_H
|
||||
#define CFDSTRUCTDATAMANAGERBASE_H
|
||||
|
||||
#include <QObject>
|
||||
#include "CFDStructDataManager_global.h"
|
||||
#include "CUIProperty/CUISigsCenter.h"
|
||||
#include "CUIProperty/CUIConfig.h"
|
||||
#include "CUIProperty/CUIDefine.h"
|
||||
|
||||
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataManagerBase : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CFDStructDataManagerBase(QObject *parent = nullptr);
|
||||
~CFDStructDataManagerBase();
|
||||
// 获取参数界面的配置
|
||||
virtual CUIConfig* getParamUIConfig();
|
||||
signals:
|
||||
|
||||
protected:
|
||||
CUIConfig* m_uiConfig = nullptr;
|
||||
CUISigsCenter* m_cuiSigsCenter = nullptr;
|
||||
};
|
||||
|
||||
#endif // CFDSTRUCTDATAMANAGERBASE_H
|
@ -1,97 +0,0 @@
|
||||
#include "CFDStructOperatorsBasicModelManager.h"
|
||||
|
||||
#include "GUIFrame/MainWindow.h"
|
||||
#include "GUIFrame/PropertyWidget.h"
|
||||
|
||||
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
|
||||
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
|
||||
#include "CFDStruct/CUIProperty/CUI.h"
|
||||
#include "CUIProperty/CUIConfig.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
|
||||
namespace ModelOper
|
||||
{
|
||||
CFDStructOperatorsBasicModelManager::CFDStructOperatorsBasicModelManager()
|
||||
{
|
||||
qDebug() << "build Time Mode Manager";
|
||||
}
|
||||
|
||||
CFDStructOperatorsBasicModelManager::~CFDStructOperatorsBasicModelManager()
|
||||
{
|
||||
}
|
||||
|
||||
bool CFDStructOperatorsBasicModelManager::execGUI()
|
||||
{
|
||||
QWidget* widget = nullptr;
|
||||
GUI::MainWindow* mainWindow = dynamic_cast<GUI::MainWindow*>(FITKAPP->getGlobalData()->getMainWindow());
|
||||
if (mainWindow == nullptr) {
|
||||
return false;
|
||||
}
|
||||
GUI::PropertyWidget* propertyWidget = mainWindow->getPropertyWidget();
|
||||
if (propertyWidget == nullptr) {
|
||||
return false;
|
||||
}
|
||||
// switch (_operType){
|
||||
// case ModelOper::OperManagerBase::Edit:
|
||||
// {
|
||||
// widget = new GUI::BasicModelWidget(this);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
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();
|
||||
// if (mainWindow->getPropertyWidget() && widget) {
|
||||
propertyWidget->setWidget(widget);
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CFDStructOperatorsBasicModelManager::execProfession()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
#ifndef _CFDStructOperatorsBasicModelManager_H
|
||||
#define _CFDStructOperatorsBasicModelManager_H
|
||||
|
||||
#include "CFDStructOperatorsModelAPI.h"
|
||||
#include "OperatorsModel/OperManagerBase.h"
|
||||
|
||||
namespace ModelOper
|
||||
{
|
||||
|
||||
class CFDStructOperatorsModelAPI CFDStructOperatorsBasicModelManager : public OperManagerBase
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Operators Mesh Base Manager object
|
||||
*/
|
||||
CFDStructOperatorsBasicModelManager();
|
||||
/**
|
||||
* @brief Destroy the Operators Mesh Base Manager object
|
||||
*/
|
||||
~CFDStructOperatorsBasicModelManager();
|
||||
/**
|
||||
* @brief 执行
|
||||
* @return true 成功
|
||||
* @return false 失败
|
||||
*/
|
||||
virtual bool execGUI();
|
||||
/**
|
||||
* @brief 执行结果处理
|
||||
* @return true 成功
|
||||
* @return false 失败
|
||||
*/
|
||||
virtual bool execProfession();
|
||||
};
|
||||
|
||||
// 按钮注册相关操作
|
||||
Register2FITKOPeratorRepo(actionBasicModelEdit, CFDStructOperatorsBasicModelManager);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,9 +1,7 @@
|
||||
HEADERS += \
|
||||
$$PWD/CFDStructOperatorsModelAPI.h \
|
||||
$$PWD/CFDStructOperatorsBasicModelManager.h \
|
||||
$$PWD/CFDStructOperatorsTimeModeManager.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/CFDStructOperatorsBasicModelManager.cpp \
|
||||
$$PWD/CFDStructOperatorsTimeModeManager.cpp
|
||||
|
||||
|
@ -0,0 +1,148 @@
|
||||
#include "CUIComponentBase.h"
|
||||
|
||||
CUIComponentBase::CUIComponentBase(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
this->initSetting();
|
||||
}
|
||||
|
||||
void CUIComponentBase::initSetting()
|
||||
{
|
||||
if (!m_conf) {
|
||||
return;
|
||||
}
|
||||
m_dataType = (CUI_DATA_TYPE)m_conf->getPropertyOriginValue("m_dataType").toInt();
|
||||
if(m_conf->getPropertyValue("initial_value") != QVariant::Invalid) {
|
||||
m_value = m_conf->getPropertyOriginValue("initial_value");
|
||||
}
|
||||
// 初始化是否必填
|
||||
if(m_conf->getPropertyValue("required") != QVariant::Invalid) {
|
||||
m_required = m_conf->getPropertyOriginValue("required").toBool();
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_STRING) {
|
||||
m_checkRange = false;
|
||||
return;
|
||||
}
|
||||
// 是否检查范围
|
||||
if(m_conf->getPropertyValue("check_range") != QVariant::Invalid) {
|
||||
m_checkRange = m_conf->getPropertyOriginValue("check_range").toBool();
|
||||
}
|
||||
// 左值和右值是否包含
|
||||
if(m_conf->getPropertyOriginValue("inclusive_min") != QVariant::Invalid) {
|
||||
m_inclusiveMin = m_conf->getPropertyOriginValue("inclusive_min").toBool();
|
||||
}
|
||||
if(m_conf->getPropertyOriginValue("inclusive_max") != QVariant::Invalid) {
|
||||
m_inclusiveMax = m_conf->getPropertyOriginValue("inclusive_max").toBool();
|
||||
}
|
||||
// 初始化左值和右值
|
||||
if (m_checkRange) {
|
||||
if(m_conf->getPropertyOriginValue("range_min") != QVariant::Invalid) {
|
||||
m_rangeMin = m_conf->getPropertyValue("range_min");
|
||||
} else {
|
||||
if (m_dataType == CUI_DATA_TYPE_INT) {
|
||||
m_rangeMin = INT_MIN;
|
||||
} else if (m_dataType == CUI_DATA_TYPE_DOUBLE) {
|
||||
m_rangeMin = DBL_MIN;
|
||||
}
|
||||
}
|
||||
if(m_conf->getPropertyOriginValue("range_max") != QVariant::Invalid) {
|
||||
m_rangeMax = m_conf->getPropertyValue("range_max");
|
||||
} else {
|
||||
if (m_dataType == CUI_DATA_TYPE_INT) {
|
||||
m_rangeMin = INT_MAX;
|
||||
} else if (m_dataType == CUI_DATA_TYPE_DOUBLE) {
|
||||
m_rangeMin = DBL_MAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CUIComponentBase::inRange()
|
||||
{
|
||||
if(m_checkRange) {
|
||||
// 如果包含最小值,但是修改后的值小于最小值,则不在范围内
|
||||
if (m_inclusiveMin && m_value < m_rangeMin ) {
|
||||
return false;
|
||||
}
|
||||
// 如果不包含最小值,但是修改后的值小于等于最小值,则不在范围内
|
||||
if (!m_inclusiveMin && m_value <= m_rangeMin ) {
|
||||
return false;
|
||||
}
|
||||
// 如果包含最大值,但是修改后的值大于最大值,则不在范围内
|
||||
if (m_inclusiveMax && m_value > m_rangeMax ) {
|
||||
return false;
|
||||
}
|
||||
// 如果不包含最大值,但是修改后的值大于等于最大值,则不在范围内
|
||||
if (!m_inclusiveMax && m_value >= m_rangeMax ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CUIComponentBase::initUI()
|
||||
{
|
||||
}
|
||||
|
||||
void CUIComponentBase::initValidator()
|
||||
{
|
||||
}
|
||||
|
||||
QString CUIComponentBase::getValueString()
|
||||
{
|
||||
if (m_value == QVariant::Invalid) {
|
||||
return QString("");
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_STRING) {
|
||||
return m_value.toString();
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_INT) {
|
||||
return QString::number(m_value.toInt());
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_STRING) {
|
||||
return QString::number(m_value.toDouble());
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
QString CUIComponentBase::getRangeMinString()
|
||||
{
|
||||
if (m_rangeMin == QVariant::Invalid) {
|
||||
return QString("");
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_STRING) {
|
||||
return m_rangeMin.toString();
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_INT) {
|
||||
return QString::number(m_rangeMin.toInt());
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_STRING) {
|
||||
return QString::number(m_rangeMin.toDouble());
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
QString CUIComponentBase::getRangeMaxString()
|
||||
{
|
||||
if (m_rangeMax == QVariant::Invalid) {
|
||||
return QString("");
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_STRING) {
|
||||
return m_rangeMax.toString();
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_INT) {
|
||||
return QString::number(m_rangeMax.toInt());
|
||||
}
|
||||
if(m_dataType == CUI_DATA_TYPE_STRING) {
|
||||
return QString::number(m_rangeMax.toDouble());
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
void CUIComponentBase::setValueToOrigin()
|
||||
{
|
||||
if (m_conf) {
|
||||
m_conf->setValue(m_value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
#ifndef CUICOMPONENTBASE_H
|
||||
#define CUICOMPONENTBASE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVariant>
|
||||
#include "CUIPropertyAPI.h"
|
||||
#include "CUIConfig.h"
|
||||
#include "CUIDefine.h"
|
||||
|
||||
class CUIPropertyAPI CUIComponentBase : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CUIComponentBase(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
// 初始化配置
|
||||
void initSetting();
|
||||
// 判断是否在范围内
|
||||
bool inRange();
|
||||
// 初始化UI
|
||||
virtual void initUI();
|
||||
// 初始化值校验器
|
||||
virtual void initValidator();
|
||||
// 获取值的字符串形式
|
||||
QString getValueString();
|
||||
// 获取最小值的字符串形式
|
||||
QString getRangeMinString();
|
||||
// 获取最大值的字符串形式
|
||||
QString getRangeMaxString();
|
||||
// 同步到数据来源
|
||||
void setValueToOrigin();
|
||||
protected:
|
||||
CUIConfig* m_conf = nullptr;
|
||||
// 值类型
|
||||
CUI_DATA_TYPE m_dataType = CUI_DATA_TYPE::CUI_DATA_TYPE_UNKNOW;
|
||||
// 具体值
|
||||
QVariant m_value = QVariant::Invalid;
|
||||
// 是否检查范围
|
||||
bool m_checkRange = false;
|
||||
// 左值
|
||||
QVariant m_rangeMin;
|
||||
// 右值
|
||||
QVariant m_rangeMax;
|
||||
// 是否包含左值
|
||||
bool m_inclusiveMin = false;
|
||||
// 是否包含右值
|
||||
bool m_inclusiveMax = false;
|
||||
// 是否是必填
|
||||
bool m_required = true;
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // CUICOMPONENTBASE_H
|
@ -0,0 +1,11 @@
|
||||
#ifndef CUIDEFINE_H
|
||||
#define CUIDEFINE_H
|
||||
|
||||
enum CUI_DATA_TYPE {
|
||||
CUI_DATA_TYPE_INT,
|
||||
CUI_DATA_TYPE_DOUBLE,
|
||||
CUI_DATA_TYPE_STRING,
|
||||
CUI_DATA_TYPE_UNKNOW,
|
||||
};
|
||||
|
||||
#endif // CUIDEFINE_H
|
Loading…
Reference in New Issue