diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataManager.pri b/CFDStruct/CFDStructDataManager/CFDStructDataManager.pri index e56b0f1..ccfaa72 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataManager.pri +++ b/CFDStruct/CFDStructDataManager/CFDStructDataManager.pri @@ -1,9 +1,7 @@ SOURCES += \ CFDStructDataManager.cpp \ - CFDStructTimeModeDataManager.cpp \ HEADERS += \ $$PWD/CFDStructDataDefine.h \ CFDStructDataManager_global.h \ - CFDStructDataManager.h \ - CFDStructTimeModeDataManager.h + CFDStructDataManager.h diff --git a/CFDStruct/CFDStructDataManager/CFDStructTimeModeDataManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructTimeModeDataManager.cpp deleted file mode 100644 index 6681aad..0000000 --- a/CFDStruct/CFDStructDataManager/CFDStructTimeModeDataManager.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "CFDStructTimeModeDataManager.h" - -CFDStructTimeModeDataManager &CFDStructTimeModeDataManager::GetInstance() -{ - static CFDStructTimeModeDataManager res; - return res; -} diff --git a/CFDStruct/CFDStructDataManager/CFDStructTimeModeDataManager.h b/CFDStruct/CFDStructDataManager/CFDStructTimeModeDataManager.h deleted file mode 100644 index fb696ae..0000000 --- a/CFDStruct/CFDStructDataManager/CFDStructTimeModeDataManager.h +++ /dev/null @@ -1,15 +0,0 @@ -#include "CFDStructDataManager_global.h" - -class CFDSTRUCTDATAMANAGER_EXPORT CFDStructTimeModeDataManager{ -public: - static int timeMode; - static int iterationSteps; - - static CFDStructTimeModeDataManager& GetInstance(); - - int& getTimeModeAddr(); - int& getIterationoStepsAddr(); -private: - CFDStructTimeModeDataManager(); - ~CFDStructTimeModeDataManager(); -}; diff --git a/CFDStruct/CUIProperty/CUI.cpp b/CFDStruct/CUIProperty/CUI.cpp index 2f9f06f..65708d0 100644 --- a/CFDStruct/CUIProperty/CUI.cpp +++ b/CFDStruct/CUIProperty/CUI.cpp @@ -28,15 +28,14 @@ CUI::CUI(CUIConfig *conf) */ void CUI::buildUI() { - QString type = conf->property["type"]; +// QString type = conf->property["type"]; + QString type = conf->getPropertyValue("type"); if(type == "") return; -// qDebug()<<"start_build"; if(type == "Widget") { -// qDebug()<<"build widget"; uiWidget = new CUIWidget(conf,subCUI); } if(type == "GroupBox") @@ -81,34 +80,35 @@ void CUI::check() */ QWidget *CUI::getUI() { - if(conf->property["type"] == "Widget"){ + QString type = conf->getPropertyValue("type"); + if(type == "Widget"){ return uiWidget; } - if(conf->property["type"] == "GroupBox"){ + if(type == "GroupBox"){ return uiGroupBox; } - if(conf->property["type"] == "LineEdit"){ + if(type == "LineEdit"){ return uiLineEdit; } - if(conf->property["type"] == "TabWidget"){ + if(type == "TabWidget"){ return uiTabWidget; } - if(conf->property["type"] == "ComboBox"){ + if(type == "ComboBox"){ return uiComboBox; } - if(conf->property["type"] == "Item"){ + if(type == "Item"){ return NULL; } - if(conf->property["type"] == "PushButton"){ + if(type == "PushButton"){ return uiPushButton; } - if(conf->property["type"] == "CheckBox"){ + if(type == "CheckBox"){ return uiCheckBox; } - if(conf->property["type"] == "ButtonBox"){ + if(type == "ButtonBox"){ return uiButtonBox; } - if(conf->property["type"] == "RadioButton"){ + if(type == "RadioButton"){ return uiRadioButton; } @@ -122,7 +122,8 @@ QWidget *CUI::getUI() */ QString CUI::getProperty(QString s) { - return conf->property[s]; +// return conf->property[s]; + return conf->getPropertyValue(s); } /** @@ -142,10 +143,11 @@ void CUI::autoArrangeWidgets() qint32 CUI::getMaxLabelWidth() { qint32 res = INT_MIN; - if(conf->property["type"] == "LineEdit"){ + QString type = conf->getPropertyValue("type"); + if(type == "LineEdit"){ res = uiLineEdit->getLabelWidth(); } - else if(conf->property["type"] == "ComboBox"){ + else if(type == "ComboBox"){ res = uiComboBox->getLabelWidth(); }else{ for(auto &ui:subCUI){ @@ -157,10 +159,11 @@ qint32 CUI::getMaxLabelWidth() void CUI::setLabelWidth(qint32 width) { - if(conf->property["type"] == "LineEdit"){ + QString type = conf->getPropertyValue("type"); + if(type == "LineEdit"){ uiLineEdit->setLabelWidth(width); } - else if(conf->property["type"] == "ComboBox"){ + else if(type == "ComboBox"){ uiComboBox->setLabelWidth(width); }else{ for(auto &ui:subCUI){ diff --git a/CFDStruct/CUIProperty/CUICheckBox.cpp b/CFDStruct/CUIProperty/CUICheckBox.cpp index 1a5ea46..8eb4791 100644 --- a/CFDStruct/CUIProperty/CUICheckBox.cpp +++ b/CFDStruct/CUIProperty/CUICheckBox.cpp @@ -11,5 +11,5 @@ CUICheckBox::CUICheckBox(CUIConfig* conf, QVector &subCUI, QWidget *parent void CUICheckBox::iniUI(QVector &subCUI) { - this->setText(conf->property["name"]); + this->setText(conf->getPropertyValue("name")); } diff --git a/CFDStruct/CUIProperty/CUIComboBox.cpp b/CFDStruct/CUIProperty/CUIComboBox.cpp index d740207..759a3d9 100644 --- a/CFDStruct/CUIProperty/CUIComboBox.cpp +++ b/CFDStruct/CUIProperty/CUIComboBox.cpp @@ -43,7 +43,7 @@ void CUIComboBox::setLabelWidth(qint32 width) */ void CUIComboBox::iniUI(QVector &subCUI) { - label = new QLabel(conf->property["name"]); + label = new QLabel(conf->getPropertyValue("name")); comboBox = new QComboBox; layout = new QHBoxLayout; this->setLayout(layout); @@ -69,8 +69,9 @@ void CUIComboBox::iniUI(QVector &subCUI) */ void CUIComboBox::iniComoboBox() { - for(auto cui:conf->sub){ - if(cui->property["type"] != "Item"){ + for(auto cui:conf->getSub()){ + QString type = cui->getPropertyValue("type"); + if(type != "Item"){ qDebug()<<"wrong type!!!"; return; } diff --git a/CFDStruct/CUIProperty/CUICommon.cpp b/CFDStruct/CUIProperty/CUICommon.cpp index 78e5260..2660a20 100644 --- a/CFDStruct/CUIProperty/CUICommon.cpp +++ b/CFDStruct/CUIProperty/CUICommon.cpp @@ -19,7 +19,8 @@ QLayout* CUICommon::appLayout(CUIConfig* conf) { QLayout* res_layout; - QString confLayout = conf->property["layout"]; +// QString confLayout = conf->property["layout"]; + QString confLayout = conf->getPropertyValue("layout"); if(confLayout == "QVBoxLayout") res_layout = new QVBoxLayout; else if (confLayout == "QHBoxLayout") { diff --git a/CFDStruct/CUIProperty/CUIConfig.cpp b/CFDStruct/CUIProperty/CUIConfig.cpp index 9098d97..827116b 100644 --- a/CFDStruct/CUIProperty/CUIConfig.cpp +++ b/CFDStruct/CUIProperty/CUIConfig.cpp @@ -101,6 +101,11 @@ void CUIConfig::setValue(QVariant value) } } +/** + * @brief CUIConfig::getPropertyValue 获取属性值 + * @param key 属性名 + * @return + */ QString CUIConfig::getPropertyValue(QString key) { if(property.contains(key)) { @@ -109,6 +114,11 @@ QString CUIConfig::getPropertyValue(QString key) return QString(); } +/** + * @brief CUIConfig::getPropertyOriginValue 获取属性地址 + * @param key 属性名 + * @return + */ QVariant CUIConfig::getPropertyOriginValue(QString key) { if(property.contains(key)) { @@ -117,6 +127,11 @@ QVariant CUIConfig::getPropertyOriginValue(QString key) return QVariant::Invalid; } +QVector CUIConfig::getSub() +{ + return this->sub; +} + /** * @brief CUIConfig::setDefault 初始化属性 diff --git a/CFDStruct/CUIProperty/CUIConfig.h b/CFDStruct/CUIProperty/CUIConfig.h index 7daa6c3..2e6a50e 100644 --- a/CFDStruct/CUIProperty/CUIConfig.h +++ b/CFDStruct/CUIProperty/CUIConfig.h @@ -15,6 +15,7 @@ public: void setValue(QVariant); QString getPropertyValue(QString); QVariant getPropertyOriginValue(QString); + QVector getSub(); private: void setDefault(); void setDefault(QString key, QVariant val); diff --git a/CFDStruct/CUIProperty/CUIGroupBox.cpp b/CFDStruct/CUIProperty/CUIGroupBox.cpp index f1f23ed..ba2dddf 100644 --- a/CFDStruct/CUIProperty/CUIGroupBox.cpp +++ b/CFDStruct/CUIProperty/CUIGroupBox.cpp @@ -23,13 +23,13 @@ CUIGroupBox::CUIGroupBox(CUIConfig* conf, QVector &subCUI, QWidget *parent */ void CUIGroupBox::iniUI(QVector &subCUI) { - this->setTitle(conf->property["name"]); + this->setTitle(conf->getPropertyValue("name")); // appLayout(); layout = appLayout(conf); this->setLayout(layout); - qDebug()<conf->sub.size(); - for(auto conf : this->conf->sub){ + qDebug()<conf->getSub().size(); + for(auto conf : this->conf->getSub()){ CUI* tmp = new CUI(conf); subCUI.push_back(tmp); diff --git a/CFDStruct/CUIProperty/CUILineEdit.cpp b/CFDStruct/CUIProperty/CUILineEdit.cpp index c5ed29d..ec66048 100644 --- a/CFDStruct/CUIProperty/CUILineEdit.cpp +++ b/CFDStruct/CUIProperty/CUILineEdit.cpp @@ -77,12 +77,11 @@ void CUILineEdit::setLabelWidth(qint32 width) void CUILineEdit::iniUI(QVector &subCUI) { layout = new QHBoxLayout(); - label = new QLabel(conf->property["name"]); + label = new QLabel(conf->getPropertyValue("name")); lineedit = new QLineEdit(initial_value_); layout->addWidget(label); layout->addWidget(lineedit); this->setLayout(layout); - // qDebug()<<"new lineedit"; connect(lineedit, &QLineEdit::textEdited, this, &CUILineEdit::onTextChanged); } @@ -92,22 +91,20 @@ void CUILineEdit::iniUI(QVector &subCUI) */ void CUILineEdit::appSetting() { - data_type = conf->property["data_type"]; - initial_value_ = conf->property["initial_value_"]; + data_type = conf->getPropertyValue("data_type"); + initial_value_ = conf->getPropertyValue("initial_value_"); qDebug()<< initial_value_; if(data_type == "string"){ check_range_ = 0; } if(data_type == "int"){ - if(conf->property["check_range_"] == "true") + if(conf->getPropertyValue("check_range_") == "true") { check_range_ = true; - range_min_ = conf->property["range_min_"].toInt(); - range_max_ = conf->property["range_max_"].toInt(); + range_min_ = conf->getPropertyValue("range_min_").toInt(); + range_max_ = conf->getPropertyValue("range_max_").toInt(); - qDebug()<property["name"]<<' '<property["inclusive_"] == "true") + if(conf->getPropertyValue("inclusive_") == "true") inclusive_ = true; else inclusive_ = false; @@ -116,19 +113,20 @@ void CUILineEdit::appSetting() } } if(data_type == "double"){ - if(conf->property["check_range_"] == "true"){ + if(conf->getPropertyValue("check_range_") == "true"){ check_range_ = true; - range_min_ = conf->property["range_min_"].toDouble(); - range_max_ = conf->property["range_max_"].toDouble(); - if(conf->property["inclusive_"] == "true") - inclusive_ = true; - else - inclusive_ = false; + range_min_ = conf->getPropertyValue("range_min_").toDouble(); + range_max_ = conf->getPropertyValue("range_max_").toDouble(); + + if(conf->getPropertyValue("inclusive_") == "true") + inclusive_ = true; + else + inclusive_ = false; }else{ check_range_ = false; } } - if(conf->property["required_"] == "false") + if(conf->getPropertyValue("required_") == "false") required_ = false; else required_ = true; diff --git a/CFDStruct/CUIProperty/CUIProperty.pro b/CFDStruct/CUIProperty/CUIProperty.pro index d0066be..0dcff33 100644 --- a/CFDStruct/CUIProperty/CUIProperty.pro +++ b/CFDStruct/CUIProperty/CUIProperty.pro @@ -23,6 +23,7 @@ win32{ Release:OBJECTS_DIR = ../../generate/CUIProperty/release/obj Release:LIBS += \ -L../../output/bin \ + -lCFDStructDataManager @@ -34,6 +35,8 @@ win32{ Debug:OBJECTS_DIR = ../../generate/CUIProperty/debug/obj Debug:LIBS += \ -L../../output/bin_d \ + -lCFDStructDataManager + @@ -55,6 +58,8 @@ unix{ OBJECTS_DIR = ../../generate/CUIProperty/release/obj LIBS += \ -L../../output/bin \ + -lCFDStructDataManager + message("Linux CUIProperty generated") diff --git a/CFDStruct/CUIProperty/CUIPushButton.cpp b/CFDStruct/CUIProperty/CUIPushButton.cpp index 6c48a28..5aa585b 100644 --- a/CFDStruct/CUIProperty/CUIPushButton.cpp +++ b/CFDStruct/CUIProperty/CUIPushButton.cpp @@ -11,6 +11,6 @@ CUIPushButton::CUIPushButton(CUIConfig* conf, QVector &subCUI, QWidget *pa void CUIPushButton::iniUI(QVector &subCUI) { - this->setText(conf->property["name"]); + this->setText(conf->getPropertyValue("name")); } diff --git a/CFDStruct/CUIProperty/CUIRadioButton.cpp b/CFDStruct/CUIProperty/CUIRadioButton.cpp index 2c6a3ec..2e9beb6 100644 --- a/CFDStruct/CUIProperty/CUIRadioButton.cpp +++ b/CFDStruct/CUIProperty/CUIRadioButton.cpp @@ -13,7 +13,5 @@ CUIRadioButton::CUIRadioButton(CUIConfig* conf, QVector subCUI,QWidget *pa void CUIRadioButton::iniUI() { - this->setText(conf->property["name"]); -// qDebug()<<"Radio ini "<property["name"]; - + this->setText(conf->getPropertyValue("name")); } diff --git a/CFDStruct/CUIProperty/CUITabWidget.cpp b/CFDStruct/CUIProperty/CUITabWidget.cpp index dee4877..652bfc5 100644 --- a/CFDStruct/CUIProperty/CUITabWidget.cpp +++ b/CFDStruct/CUIProperty/CUITabWidget.cpp @@ -20,9 +20,9 @@ CUITabWidget::CUITabWidget(CUIConfig* conf, QVector &subCUI, QWidget *pare */ void CUITabWidget::iniUI(QVector &subCUI) { - for(auto conf:conf->sub){ + for(auto conf:conf->getSub()){ CUI* subui = new CUI(conf); subCUI.push_back(subui); - this->addTab(subui->getUI(),conf->property["name"]); + this->addTab(subui->getUI(),conf->getPropertyValue("name")); } } diff --git a/CFDStruct/CUIProperty/CUIWidget.cpp b/CFDStruct/CUIProperty/CUIWidget.cpp index 3d85113..394f652 100644 --- a/CFDStruct/CUIProperty/CUIWidget.cpp +++ b/CFDStruct/CUIProperty/CUIWidget.cpp @@ -28,7 +28,7 @@ void CUIWidget::iniUI(QVector &subCUI) // qDebug()<<"widget add layout"; - for(auto &conf : this->conf->sub){ + for(auto &conf : this->conf->getSub()){ CUI* tmp = new CUI(conf); subCUI.push_back(tmp); layout->addWidget(tmp->getUI()); @@ -42,7 +42,7 @@ void CUIWidget::iniUI(QVector &subCUI) */ QString CUIWidget::getProperty(QString key) { - return conf->property[key]; + return conf->getPropertyValue(key); }