From 696f581460d0a9f9205e9b78a305dbd898cb9109 Mon Sep 17 00:00:00 2001 From: simonyan <315082291@qq.com> Date: Fri, 1 Nov 2024 21:57:12 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=9E=84=E5=BB=BA=E5=A4=9A=E9=80=89?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E7=BB=84=E4=BB=B6=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CFDStructDataManager.cpp | 6 +- .../CFDStructDataManager.h | 3 + .../CFDStructDataManager.pri | 6 ++ ...uctDataSolverMonitorAerodynamicManager.cpp | 11 +++ ...tructDataSolverMonitorAerodynamicManager.h | 13 ++++ ...StructDataSolverMonitorImpellerManager.cpp | 11 +++ ...FDStructDataSolverMonitorImpellerManager.h | 14 ++++ ...StructDataSolverMonitorResidualManager.cpp | 12 ++++ ...FDStructDataSolverMonitorResidualManager.h | 14 ++++ CFDStruct/CFDStructMain/CFDTreeWidget.cpp | 4 +- CFDStruct/CUIProperty/CUI.cpp | 3 + CFDStruct/CUIProperty/CUIButtonBox.cpp | 6 +- CFDStruct/CUIProperty/CUIButtonBox.h | 2 +- CFDStruct/CUIProperty/CUICheckBox.cpp | 4 +- CFDStruct/CUIProperty/CUICheckBox.h | 2 +- CFDStruct/CUIProperty/CUIComboBox.cpp | 6 +- CFDStruct/CUIProperty/CUIComboBox.h | 2 +- .../CUIComponentBaseContainerWidget.cpp | 5 ++ .../CUIComponentBaseContainerWidget.h | 1 + .../CUIProperty/CUIComponentBaseWidget.cpp | 5 ++ .../CUIProperty/CUIComponentBaseWidget.h | 4 +- CFDStruct/CUIProperty/CUIGroupBox.cpp | 6 +- CFDStruct/CUIProperty/CUIGroupBox.h | 2 +- CFDStruct/CUIProperty/CUILineEdit.cpp | 6 +- CFDStruct/CUIProperty/CUILineEdit.h | 2 +- CFDStruct/CUIProperty/CUIMultiTableWidget.cpp | 67 +++++++++++++++++++ CFDStruct/CUIProperty/CUIMultiTableWidget.h | 24 +++++++ CFDStruct/CUIProperty/CUIProperty.pri | 52 +++++++------- CFDStruct/CUIProperty/CUIPushButton.cpp | 4 +- CFDStruct/CUIProperty/CUIPushButton.h | 2 +- CFDStruct/CUIProperty/CUIRadioButton.cpp | 4 +- CFDStruct/CUIProperty/CUIRadioButton.h | 2 +- CFDStruct/CUIProperty/CUITabWidget.cpp | 6 +- CFDStruct/CUIProperty/CUITabWidget.h | 2 +- CFDStruct/CUIProperty/CUIWidget.cpp | 6 +- CFDStruct/CUIProperty/CUIWidget.h | 2 +- 36 files changed, 259 insertions(+), 62 deletions(-) create mode 100644 CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorAerodynamicManager.cpp create mode 100644 CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorAerodynamicManager.h create mode 100644 CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorImpellerManager.cpp create mode 100644 CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorImpellerManager.h create mode 100644 CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorResidualManager.cpp create mode 100644 CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorResidualManager.h create mode 100644 CFDStruct/CUIProperty/CUIMultiTableWidget.cpp create mode 100644 CFDStruct/CUIProperty/CUIMultiTableWidget.h diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp index 7d9bd94..8754697 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp @@ -10,6 +10,7 @@ #include "CFDStructDataSolverInitializationManager.h" #include "CFDStructDataSolverReferenceQuantityManager.h" #include "CFDStructDataSolverComputingControlManager.h" +#include "CFDStructDataSolverMonitorResidualManager.h" #include "CUIProperty/CUIConfig.h" @@ -57,7 +58,8 @@ CUIConfig *CFDStructDataManager::getActionParamUIConfig(QString s) // 计算控制 if (s == "actionComputationalControlEdit") return m_solverComputingControlManager->getParamUIConfig(); - + if (s == "actionComputationalMonitorsResidual") + return m_solverMonitorResidualManager->getParamUIConfig(); qDebug() << "DataManager return null CUIConfig"; return nullptr; } @@ -74,4 +76,6 @@ void CFDStructDataManager::initDataManagers() m_solverInitializationManager = new CFDStructDataSolverInitializationManager; m_solverReferenceQuantityManager = new CFDStructDataSolverReferenceQuantityManager; m_solverComputingControlManager = new CFDStructDataSolverComputingControlManager; + + m_solverMonitorResidualManager = new CFDStructDataSolverMonitorResidualManager; } diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataManager.h index 213c07e..846d8e5 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataManager.h @@ -13,6 +13,7 @@ class CFDStructDataSolverTimeModeManager; class CFDStructDataSolverBasicModelManager; class CFDStructDataSolverKvislManager; class CFDStructDataSolverNumericalMethodManager; +class CFDStructDataSolverMonitorResidualManager; class CUIConfig; class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataManager @@ -45,6 +46,8 @@ private: CFDStructDataSolverReferenceQuantityManager *m_solverReferenceQuantityManager; // 计算控制 CFDStructDataSolverComputingControlManager *m_solverComputingControlManager; + // 监控-残差曲线 + CFDStructDataSolverMonitorResidualManager *m_solverMonitorResidualManager; }; #endif // CFDSTRUCTDATAMANAGER_H diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataManager.pri b/CFDStruct/CFDStructDataManager/CFDStructDataManager.pri index 52e6b39..ccf5856 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataManager.pri +++ b/CFDStruct/CFDStructDataManager/CFDStructDataManager.pri @@ -3,6 +3,9 @@ SOURCES += \ $$PWD/CFDStructDataSolverBoundaryConditionManager.cpp \ $$PWD/CFDStructDataSolverComputingControlManager.cpp \ $$PWD/CFDStructDataSolverInitializationManager.cpp \ + $$PWD/CFDStructDataSolverMonitorAerodynamicManager.cpp \ + $$PWD/CFDStructDataSolverMonitorImpellerManager.cpp \ + $$PWD/CFDStructDataSolverMonitorResidualManager.cpp \ $$PWD/CFDStructDataSolverReferenceQuantityManager.cpp \ $$PWD/CFDStructDataSolverSportsAttributesManager.cpp \ $$PWD/CFDStructDataSolverTimeModeManager.cpp \ @@ -17,6 +20,9 @@ HEADERS += \ $$PWD/CFDStructDataSolverBoundaryConditionManager.h \ $$PWD/CFDStructDataSolverComputingControlManager.h \ $$PWD/CFDStructDataSolverInitializationManager.h \ + $$PWD/CFDStructDataSolverMonitorAerodynamicManager.h \ + $$PWD/CFDStructDataSolverMonitorImpellerManager.h \ + $$PWD/CFDStructDataSolverMonitorResidualManager.h \ $$PWD/CFDStructDataSolverReferenceQuantityManager.h \ $$PWD/CFDStructDataSolverSportsAttributesManager.h \ $$PWD/CFDStructDataSolverTimeModeManager.h \ diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorAerodynamicManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorAerodynamicManager.cpp new file mode 100644 index 0000000..164fb04 --- /dev/null +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorAerodynamicManager.cpp @@ -0,0 +1,11 @@ +#include "CFDStructDataSolverMonitorAerodynamicManager.h" + +CFDStructDataSolverMonitorAerodynamicManager::CFDStructDataSolverMonitorAerodynamicManager(QObject *parent) : CFDStructDataSolverBasicModelManager(parent) +{ + +} + +CUIConfig *CFDStructDataSolverMonitorAerodynamicManager::getParamUIConfig() +{ + return NULL; +} diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorAerodynamicManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorAerodynamicManager.h new file mode 100644 index 0000000..3cc17de --- /dev/null +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorAerodynamicManager.h @@ -0,0 +1,13 @@ +#ifndef CFDSTRUCTDATASOLVERMONITORAERODYNAMICMANAGER_H +#define CFDSTRUCTDATASOLVERMONITORAERODYNAMICMANAGER_H + +#include "CFDStructDataSolverBasicModelManager.h" + +class CFDStructDataSolverMonitorAerodynamicManager : public CFDStructDataSolverBasicModelManager +{ +public: + explicit CFDStructDataSolverMonitorAerodynamicManager(QObject *parent = nullptr); + CUIConfig* getParamUIConfig(); +}; + +#endif // CFDSTRUCTDATASOLVERMONITORAERODYNAMICMANAGER_H diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorImpellerManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorImpellerManager.cpp new file mode 100644 index 0000000..53f8207 --- /dev/null +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorImpellerManager.cpp @@ -0,0 +1,11 @@ +#include "CFDStructDataSolverMonitorImpellerManager.h" + +CFDStructDataSolverMonitorImpellerManager::CFDStructDataSolverMonitorImpellerManager(QObject *parent) : CFDStructDataSolverBasicModelManager(parent) +{ + +} + +CUIConfig *CFDStructDataSolverMonitorImpellerManager::getParamUIConfig() +{ + return NULL; +} diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorImpellerManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorImpellerManager.h new file mode 100644 index 0000000..6bba005 --- /dev/null +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorImpellerManager.h @@ -0,0 +1,14 @@ +#ifndef CFDSTRUCTDATASOLVERMONITORIMPELLERMANAGER_H +#define CFDSTRUCTDATASOLVERMONITORIMPELLERMANAGER_H + +#include "CFDStructDataSolverBasicModelManager.h" + +class CFDStructDataSolverMonitorImpellerManager : public CFDStructDataSolverBasicModelManager +{ +public: + explicit CFDStructDataSolverMonitorImpellerManager(QObject *parent = nullptr); + + CUIConfig* getParamUIConfig(); +}; + +#endif // CFDSTRUCTDATASOLVERMONITORIMPELLERMANAGER_H diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorResidualManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorResidualManager.cpp new file mode 100644 index 0000000..1e3486d --- /dev/null +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorResidualManager.cpp @@ -0,0 +1,12 @@ +#include "CFDStructDataSolverMonitorResidualManager.h" + +CFDStructDataSolverMonitorResidualManager::CFDStructDataSolverMonitorResidualManager(QObject *parent) : CFDStructDataSolverBasicModelManager(parent) +{ + +} + +CUIConfig *CFDStructDataSolverMonitorResidualManager::getParamUIConfig() +{ + return new CUIConfig({ + {"type", "MultiTableWidget"}}, {}); +} diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorResidualManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorResidualManager.h new file mode 100644 index 0000000..5cfc53b --- /dev/null +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverMonitorResidualManager.h @@ -0,0 +1,14 @@ +#ifndef CFDSTRUCTDATASOLVERMONITORRESIDUALMANAGER_H +#define CFDSTRUCTDATASOLVERMONITORRESIDUALMANAGER_H + +#include "CFDStructDataSolverBasicModelManager.h" + +class CFDStructDataSolverMonitorResidualManager : public CFDStructDataSolverBasicModelManager +{ +public: + explicit CFDStructDataSolverMonitorResidualManager(QObject *parent = nullptr); + + CUIConfig* getParamUIConfig(); +}; + +#endif // CFDSTRUCTDATASOLVERMONITORRESIDUALMANAGER_H diff --git a/CFDStruct/CFDStructMain/CFDTreeWidget.cpp b/CFDStruct/CFDStructMain/CFDTreeWidget.cpp index e49867d..d23d69d 100644 --- a/CFDStruct/CFDStructMain/CFDTreeWidget.cpp +++ b/CFDStruct/CFDStructMain/CFDTreeWidget.cpp @@ -275,7 +275,9 @@ namespace GUI case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControl: name = "actionComputationalControlEdit"; break; - + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsResidual: + name = "actionComputationalMonitorsResidual"; + break; default: name = ""; } diff --git a/CFDStruct/CUIProperty/CUI.cpp b/CFDStruct/CUIProperty/CUI.cpp index 122164d..503203f 100644 --- a/CFDStruct/CUIProperty/CUI.cpp +++ b/CFDStruct/CUIProperty/CUI.cpp @@ -13,6 +13,7 @@ #include #include #include +#include /** @@ -57,6 +58,8 @@ void CUI::buildUI() widget = new CUIButtonBox(conf, subCUI); } else if(type == "RadioComponent"){ widget = new CUIRadioComponent(conf,subCUI); + } else if(type == "MultiTableWidget") { + widget = new CUIMultiTableWidget(conf, subCUI); } if (widget) { QVBoxLayout *layout = new QVBoxLayout; diff --git a/CFDStruct/CUIProperty/CUIButtonBox.cpp b/CFDStruct/CUIProperty/CUIButtonBox.cpp index 61513c1..cac78c1 100644 --- a/CFDStruct/CUIProperty/CUIButtonBox.cpp +++ b/CFDStruct/CUIProperty/CUIButtonBox.cpp @@ -17,14 +17,14 @@ CUIButtonBox::CUIButtonBox(CUIConfig* conf, QVector &subCUI, QWidget *parent) : CUIComponentBaseContainerWidget(parent) { this->conf = conf; - iniUI(subCUI); + initUI(subCUI); } /** - * @brief CUIButtonBox::iniUI 初始化 + * @brief CUIButtonBox::initUI 初始化 * @param subCUI */ -void CUIButtonBox::iniUI(QVector &subCUI) +void CUIButtonBox::initUI(QVector &subCUI) { m_groupBox = new QGroupBox; diff --git a/CFDStruct/CUIProperty/CUIButtonBox.h b/CFDStruct/CUIProperty/CUIButtonBox.h index fabdc44..c631ab4 100644 --- a/CFDStruct/CUIProperty/CUIButtonBox.h +++ b/CFDStruct/CUIProperty/CUIButtonBox.h @@ -15,7 +15,7 @@ public: explicit CUIButtonBox(CUIConfig* conf, QVector &subCUI, QWidget *parent = nullptr); private: - void iniUI(QVector &subCUI); + void initUI(QVector &subCUI); CUIConfig* conf; QLayout* layout; QGroupBox* m_groupBox; diff --git a/CFDStruct/CUIProperty/CUICheckBox.cpp b/CFDStruct/CUIProperty/CUICheckBox.cpp index 8924827..d9bb508 100644 --- a/CFDStruct/CUIProperty/CUICheckBox.cpp +++ b/CFDStruct/CUIProperty/CUICheckBox.cpp @@ -6,10 +6,10 @@ CUICheckBox::CUICheckBox(CUIConfig* conf, QVector &subCUI, QWidget *parent) : QCheckBox(parent) { this->conf = conf; - iniUI(subCUI); + initUI(subCUI); } -void CUICheckBox::iniUI(QVector &subCUI) +void CUICheckBox::initUI(QVector &subCUI) { this->setText(conf->getPropertyValue("name")); diff --git a/CFDStruct/CUIProperty/CUICheckBox.h b/CFDStruct/CUIProperty/CUICheckBox.h index a4a5c2a..6d27daf 100644 --- a/CFDStruct/CUIProperty/CUICheckBox.h +++ b/CFDStruct/CUIProperty/CUICheckBox.h @@ -14,7 +14,7 @@ public: explicit CUICheckBox(CUIConfig* conf, QVector &subCUI, QWidget *parent = nullptr); private: - void iniUI(QVector &subCUI); + void initUI(QVector &subCUI); CUIConfig* conf; diff --git a/CFDStruct/CUIProperty/CUIComboBox.cpp b/CFDStruct/CUIProperty/CUIComboBox.cpp index a460ad3..6efbe3e 100644 --- a/CFDStruct/CUIProperty/CUIComboBox.cpp +++ b/CFDStruct/CUIProperty/CUIComboBox.cpp @@ -15,7 +15,7 @@ CUIComboBox::CUIComboBox(CUIConfig* conf, QVector &subCUI, QWidget *parent) : QWidget(parent) { this->conf = conf; - iniUI(subCUI); + initUI(subCUI); } /** @@ -39,9 +39,9 @@ void CUIComboBox::setLabelWidth(qint32 width) /** - * @brief CUIComboBox::iniUI 初始化widget,添加label和comboBox + * @brief CUIComboBox::initUI 初始化widget,添加label和comboBox */ -void CUIComboBox::iniUI(QVector &subCUI) +void CUIComboBox::initUI(QVector &subCUI) { label = new QLabel(conf->getPropertyValue("name")); comboBox = new QComboBox; diff --git a/CFDStruct/CUIProperty/CUIComboBox.h b/CFDStruct/CUIProperty/CUIComboBox.h index a8a2ef9..4a19e2f 100644 --- a/CFDStruct/CUIProperty/CUIComboBox.h +++ b/CFDStruct/CUIProperty/CUIComboBox.h @@ -17,7 +17,7 @@ public: qint32 getLabelWidth(); void setLabelWidth(qint32 width); private: - void iniUI(QVector &subCUI); + void initUI(QVector &subCUI); void iniComoboBox(); QComboBox* comboBox; QLabel* label; diff --git a/CFDStruct/CUIProperty/CUIComponentBaseContainerWidget.cpp b/CFDStruct/CUIProperty/CUIComponentBaseContainerWidget.cpp index 4e36363..b0ff33f 100644 --- a/CFDStruct/CUIProperty/CUIComponentBaseContainerWidget.cpp +++ b/CFDStruct/CUIProperty/CUIComponentBaseContainerWidget.cpp @@ -26,3 +26,8 @@ QLayout *CUIComponentBaseContainerWidget::getLayout(CUIConfig *conf) layout->setMargin(0); return layout; } + +void CUIComponentBaseContainerWidget::initUI() +{ + +} diff --git a/CFDStruct/CUIProperty/CUIComponentBaseContainerWidget.h b/CFDStruct/CUIProperty/CUIComponentBaseContainerWidget.h index 2fe4e86..0d51aea 100644 --- a/CFDStruct/CUIProperty/CUIComponentBaseContainerWidget.h +++ b/CFDStruct/CUIProperty/CUIComponentBaseContainerWidget.h @@ -12,6 +12,7 @@ public: explicit CUIComponentBaseContainerWidget(QWidget *parent = nullptr); protected: virtual QLayout* getLayout(CUIConfig* conf); + virtual void initUI(); protected: QLayout* m_layout; signals: diff --git a/CFDStruct/CUIProperty/CUIComponentBaseWidget.cpp b/CFDStruct/CUIProperty/CUIComponentBaseWidget.cpp index fe94ba7..7fffcdd 100644 --- a/CFDStruct/CUIProperty/CUIComponentBaseWidget.cpp +++ b/CFDStruct/CUIProperty/CUIComponentBaseWidget.cpp @@ -26,3 +26,8 @@ QLayout *CUIComponentBaseWidget::getLayout(CUIConfig *conf) layout->setMargin(0); return layout; } + +void CUIComponentBaseWidget::initUI() +{ + +} diff --git a/CFDStruct/CUIProperty/CUIComponentBaseWidget.h b/CFDStruct/CUIProperty/CUIComponentBaseWidget.h index 8ae1fd2..feefe9f 100644 --- a/CFDStruct/CUIProperty/CUIComponentBaseWidget.h +++ b/CFDStruct/CUIProperty/CUIComponentBaseWidget.h @@ -11,9 +11,9 @@ public: explicit CUIComponentBaseWidget(QWidget *parent = nullptr); protected: virtual QLayout* getLayout(CUIConfig* conf); - + virtual void initUI(); protected: - + QLayout* m_layout = nullptr; signals: }; diff --git a/CFDStruct/CUIProperty/CUIGroupBox.cpp b/CFDStruct/CUIProperty/CUIGroupBox.cpp index 53ee515..2c39b86 100644 --- a/CFDStruct/CUIProperty/CUIGroupBox.cpp +++ b/CFDStruct/CUIProperty/CUIGroupBox.cpp @@ -14,14 +14,14 @@ CUIGroupBox::CUIGroupBox(CUIConfig* conf, QVector &subCUI, QWidget *parent) : CUIComponentBaseContainerWidget(parent) { this->conf = conf; - iniUI(subCUI); + initUI(subCUI); } /** - * @brief CUIGroupBox::iniUI 根据配置信息进行初始化 + * @brief CUIGroupBox::initUI 根据配置信息进行初始化 */ -void CUIGroupBox::iniUI(QVector &subCUI) +void CUIGroupBox::initUI(QVector &subCUI) { m_groupBox = new QGroupBox; m_groupBox->setTitle(conf->getPropertyValue("name")); diff --git a/CFDStruct/CUIProperty/CUIGroupBox.h b/CFDStruct/CUIProperty/CUIGroupBox.h index 80fae29..e82fb78 100644 --- a/CFDStruct/CUIProperty/CUIGroupBox.h +++ b/CFDStruct/CUIProperty/CUIGroupBox.h @@ -19,7 +19,7 @@ protected: QLayout* m_layout; QGroupBox* m_groupBox; protected: - void iniUI(QVector &subCUI); + void initUI(QVector &subCUI); signals: diff --git a/CFDStruct/CUIProperty/CUILineEdit.cpp b/CFDStruct/CUIProperty/CUILineEdit.cpp index 20e22c8..63340a1 100644 --- a/CFDStruct/CUIProperty/CUILineEdit.cpp +++ b/CFDStruct/CUIProperty/CUILineEdit.cpp @@ -16,7 +16,7 @@ CUILineEdit::CUILineEdit(CUIConfig* conf, QVector &subCUI, QWidget *parent) : CUIComponentBaseWidget(parent) { this->m_conf = conf; - this->iniUI(subCUI); + this->initUI(subCUI); } @@ -40,9 +40,9 @@ void CUILineEdit::setLabelWidth(qint32 width) /** - * @brief CUILineEdit::iniUI 根据配置信息初始化 + * @brief CUILineEdit::initUI 根据配置信息初始化 */ -void CUILineEdit::iniUI(QVector &subCUI) +void CUILineEdit::initUI(QVector &subCUI) { m_layout = new QHBoxLayout(); m_label = new QLabel(m_conf->getPropertyValue("name")); diff --git a/CFDStruct/CUIProperty/CUILineEdit.h b/CFDStruct/CUIProperty/CUILineEdit.h index 52eaab7..ed82e61 100644 --- a/CFDStruct/CUIProperty/CUILineEdit.h +++ b/CFDStruct/CUIProperty/CUILineEdit.h @@ -20,7 +20,7 @@ public: qint32 getLabelWidth(); void setLabelWidth(qint32 width); private: - void iniUI(QVector &subCUI); + virtual void initUI(QVector &subCUI); // 设置格式校验器 void setValidator(); // 设置输入提示 diff --git a/CFDStruct/CUIProperty/CUIMultiTableWidget.cpp b/CFDStruct/CUIProperty/CUIMultiTableWidget.cpp new file mode 100644 index 0000000..2d1a92d --- /dev/null +++ b/CFDStruct/CUIProperty/CUIMultiTableWidget.cpp @@ -0,0 +1,67 @@ +#include "CUIMultiTableWidget.h" +#include +#include +#include +#include +#include +#include +#include +#include "CUI.h" + +CUIMultiTableWidget::CUIMultiTableWidget(CUIConfig* conf, QVector &subCUI, QWidget *parent) : CUIComponentBaseWidget(parent) +{ + this->initUI(); +} + +void CUIMultiTableWidget::initUI() +{ + QStringList headers; + headers<> items; + QList item1 = {tr("quaility"), "quaility"}; + QList item2 = {tr("x"), "x"}; + QList item3 = {tr("y"), "y"}; + QList item4 = {tr("z"), "z"}; + items.append(item1); + items.append(item2); + items.append(item3); + items.append(item4); + // 根据配置来初始化tableWidget + m_tableWidget = new QTableWidget(this); + m_tableWidget->setColumnCount(items.count() + 2); + m_tableWidget->setRowCount(items.count()); + m_tableWidget->setHorizontalHeaderLabels(headers); + // 设置水平表头的背景颜色 + m_tableWidget->setStyleSheet(QString(u8"QHeaderView::section{background-color: rgb(226,234,243); color: black; border:1px solid rgb(255, 255, 255);}")); + m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); // 禁止编辑 + m_tableWidget->setFocusPolicy(Qt::NoFocus); + // 隐藏垂直表头 + QHeaderView *verticalHeader = m_tableWidget->verticalHeader(); + verticalHeader->setVisible(false); + + for (int i=0;i item = items[i]; + // 序号 + QTableWidgetItem* indexItem = new QTableWidgetItem(QString("%1").arg(i+1)); + indexItem->setFlags(indexItem->flags() &~Qt::ItemIsSelectable); + indexItem->setTextAlignment(Qt::AlignCenter); // 设置水平居中 + m_tableWidget->setItem(i,0, indexItem); + // 内容 + for (int j=0;jsetFlags(indexItem->flags() &~Qt::ItemIsSelectable); + nameItem->setTextAlignment(Qt::AlignCenter); // 设置水平居中 + m_tableWidget->setItem(i,j+1, nameItem); + } + // 复选框 + QTableWidgetItem *checkBoxItem = new QTableWidgetItem(); + m_tableWidget->setItem(i,item.count() + 1, checkBoxItem); + QCheckBox* checkBox = new QCheckBox(); + checkBox->setStyleSheet("margin-left:45%; margin-right:45%;");// 设置水平居中 + m_tableWidget->setCellWidget(i, item.count() + 1, checkBox); + } + + m_layout = new QVBoxLayout; + m_layout->addWidget(m_tableWidget); + this->setLayout(m_layout); +} diff --git a/CFDStruct/CUIProperty/CUIMultiTableWidget.h b/CFDStruct/CUIProperty/CUIMultiTableWidget.h new file mode 100644 index 0000000..5cd6f2e --- /dev/null +++ b/CFDStruct/CUIProperty/CUIMultiTableWidget.h @@ -0,0 +1,24 @@ +#ifndef CUIMULTITABLEWIDGET_H +#define CUIMULTITABLEWIDGET_H + +#include "CUIComponentBaseWidget.h" +#include "CUIComponentBase.h" + +class QTableWidget; +class CUI; + +class CUIMultiTableWidget : public CUIComponentBaseWidget, public CUIComponentBase +{ + Q_OBJECT +public: + explicit CUIMultiTableWidget(CUIConfig* conf, QVector &subCUI, QWidget *parent = nullptr); +protected: + void initUI(); + +protected: + QTableWidget* m_tableWidget; +signals: + +}; + +#endif // CUIMULTITABLEWIDGET_H diff --git a/CFDStruct/CUIProperty/CUIProperty.pri b/CFDStruct/CUIProperty/CUIProperty.pri index 30b7271..9474942 100644 --- a/CFDStruct/CUIProperty/CUIProperty.pri +++ b/CFDStruct/CUIProperty/CUIProperty.pri @@ -4,34 +4,36 @@ HEADERS += \ $$PWD/CUIComponentBaseWidget.h \ $$PWD/CUIDefine.h \ $$PWD/CUIRadioComponent.h \ - CUI.h \ - CUIButtonBox.h \ - CUICheckBox.h \ - CUIComboBox.h \ - CUIGroupBox.h \ - CUILineEdit.h \ - CUIPushButton.h \ - CUIRadioButton.h \ - CUITabWidget.h \ - CUIWidget.h \ - CUISigsCenter.h \ - CUIPropertyAPI.h \ - CUIConfig.h + $$PWD/CUIMultiTableWidget.h \ + $$PWD/CUI.h \ + $$PWD/CUIButtonBox.h \ + $$PWD/CUICheckBox.h \ + $$PWD/CUIComboBox.h \ + $$PWD/CUIGroupBox.h \ + $$PWD/CUILineEdit.h \ + $$PWD/CUIPushButton.h \ + $$PWD/CUIRadioButton.h \ + $$PWD/CUITabWidget.h \ + $$PWD/CUIWidget.h \ + $$PWD/CUISigsCenter.h \ + $$PWD/CUIPropertyAPI.h \ + $$PWD/CUIConfig.h SOURCES += \ $$PWD/CUIComponentBase.cpp \ $$PWD/CUIComponentBaseContainerWidget.cpp \ $$PWD/CUIComponentBaseWidget.cpp \ $$PWD/CUIRadioComponent.cpp \ - CUI.cpp \ - CUIButtonBox.cpp \ - CUICheckBox.cpp \ - CUIComboBox.cpp \ - CUIGroupBox.cpp \ - CUILineEdit.cpp \ - CUIPushButton.cpp \ - CUIRadioButton.cpp \ - CUITabWidget.cpp \ - CUIWidget.cpp \ - CUIConfig.cpp \ - CUISigsCenter.cpp + $$PWD/CUIMultiTableWidget.cpp \ + $$PWD/CUI.cpp \ + $$PWD/CUIButtonBox.cpp \ + $$PWD/CUICheckBox.cpp \ + $$PWD/CUIComboBox.cpp \ + $$PWD/CUIGroupBox.cpp \ + $$PWD/CUILineEdit.cpp \ + $$PWD/CUIPushButton.cpp \ + $$PWD/CUIRadioButton.cpp \ + $$PWD/CUITabWidget.cpp \ + $$PWD/CUIWidget.cpp \ + $$PWD/CUIConfig.cpp \ + $$PWD/CUISigsCenter.cpp diff --git a/CFDStruct/CUIProperty/CUIPushButton.cpp b/CFDStruct/CUIProperty/CUIPushButton.cpp index 5aa585b..0d5209c 100644 --- a/CFDStruct/CUIProperty/CUIPushButton.cpp +++ b/CFDStruct/CUIProperty/CUIPushButton.cpp @@ -6,10 +6,10 @@ CUIPushButton::CUIPushButton(CUIConfig* conf, QVector &subCUI, QWidget *parent) : QPushButton(parent) { this->conf = conf; - iniUI(subCUI); + initUI(subCUI); } -void CUIPushButton::iniUI(QVector &subCUI) +void CUIPushButton::initUI(QVector &subCUI) { this->setText(conf->getPropertyValue("name")); } diff --git a/CFDStruct/CUIProperty/CUIPushButton.h b/CFDStruct/CUIProperty/CUIPushButton.h index a8c9add..2ec3118 100644 --- a/CFDStruct/CUIProperty/CUIPushButton.h +++ b/CFDStruct/CUIProperty/CUIPushButton.h @@ -14,7 +14,7 @@ public: explicit CUIPushButton(CUIConfig* conf, QVector &subCUI, QWidget *parent = nullptr); private: - void iniUI(QVector &subCUI); + void initUI(QVector &subCUI); CUIConfig* conf; signals: diff --git a/CFDStruct/CUIProperty/CUIRadioButton.cpp b/CFDStruct/CUIProperty/CUIRadioButton.cpp index 2e9beb6..a7554b4 100644 --- a/CFDStruct/CUIProperty/CUIRadioButton.cpp +++ b/CFDStruct/CUIProperty/CUIRadioButton.cpp @@ -7,10 +7,10 @@ CUIRadioButton::CUIRadioButton(CUIConfig* conf, QVector subCUI,QWidget *parent) : QRadioButton(parent) { this->conf = conf; - iniUI(); + initUI(); } -void CUIRadioButton::iniUI() +void CUIRadioButton::initUI() { this->setText(conf->getPropertyValue("name")); diff --git a/CFDStruct/CUIProperty/CUIRadioButton.h b/CFDStruct/CUIProperty/CUIRadioButton.h index 1c2175b..108f86d 100644 --- a/CFDStruct/CUIProperty/CUIRadioButton.h +++ b/CFDStruct/CUIProperty/CUIRadioButton.h @@ -15,7 +15,7 @@ public: explicit CUIRadioButton(CUIConfig* conf, QVector subCUI, QWidget *parent = nullptr); private: - void iniUI(); + void initUI(); CUIConfig* conf; signals: diff --git a/CFDStruct/CUIProperty/CUITabWidget.cpp b/CFDStruct/CUIProperty/CUITabWidget.cpp index e642688..a620ae7 100644 --- a/CFDStruct/CUIProperty/CUITabWidget.cpp +++ b/CFDStruct/CUIProperty/CUITabWidget.cpp @@ -12,13 +12,13 @@ CUITabWidget::CUITabWidget(CUIConfig* conf, QVector &subCUI, QWidget *parent) : QTabWidget(parent) { this->conf = conf; - iniUI(subCUI); + initUI(subCUI); } /** - * @brief CUITabWidget::iniUI 根据配置信息初始化 + * @brief CUITabWidget::initUI 根据配置信息初始化 */ -void CUITabWidget::iniUI(QVector &subCUI) +void CUITabWidget::initUI(QVector &subCUI) { for(auto conf : conf->getSub()) { CUI* subui = new CUI(nullptr, conf); diff --git a/CFDStruct/CUIProperty/CUITabWidget.h b/CFDStruct/CUIProperty/CUITabWidget.h index 2e670b3..b0b36a8 100644 --- a/CFDStruct/CUIProperty/CUITabWidget.h +++ b/CFDStruct/CUIProperty/CUITabWidget.h @@ -13,7 +13,7 @@ public: explicit CUITabWidget(CUIConfig* conf, QVector &subCUI, QWidget *parent = nullptr); private: - void iniUI(QVector &subCUI); + void initUI(QVector &subCUI); CUIConfig* conf; QVector subUI; diff --git a/CFDStruct/CUIProperty/CUIWidget.cpp b/CFDStruct/CUIProperty/CUIWidget.cpp index 10482ce..94757e0 100644 --- a/CFDStruct/CUIProperty/CUIWidget.cpp +++ b/CFDStruct/CUIProperty/CUIWidget.cpp @@ -14,13 +14,13 @@ CUIWidget::CUIWidget(CUIConfig *conf, QVector &subCUI, QWidget *parent): CUIComponentBaseContainerWidget(parent) { this->m_conf = conf; - iniUI(subCUI); + initUI(subCUI); } /** - * @brief CUIWidget::iniUI 根据配置信息初始化 + * @brief CUIWidget::initUI 根据配置信息初始化 */ -void CUIWidget::iniUI(QVector &subCUI) +void CUIWidget::initUI(QVector &subCUI) { m_layout = this->getLayout(m_conf); this->setLayout(m_layout); diff --git a/CFDStruct/CUIProperty/CUIWidget.h b/CFDStruct/CUIProperty/CUIWidget.h index 030832e..8bc0594 100644 --- a/CFDStruct/CUIProperty/CUIWidget.h +++ b/CFDStruct/CUIProperty/CUIWidget.h @@ -13,7 +13,7 @@ class CUIWidget : public CUIComponentBaseContainerWidget, CUIComponentBase public: explicit CUIWidget(CUIConfig* conf, QVector &subCUI, QWidget *parent = nullptr); private: - void iniUI(QVector &subCUI); + void initUI(QVector &subCUI); signals: };