From 341481b9e4f186fa88673f7a087c59fa1ad2a434 Mon Sep 17 00:00:00 2001 From: mzh Date: Fri, 8 Nov 2024 16:44:02 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9CUIComponentBaseWid?= =?UTF-8?q?get=E4=B8=AD=EF=BC=8Clayout=E8=AE=BE=E7=BD=AE=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=9A=E4=B8=8D=E8=83=BD=E6=AD=A3=E7=A1=AE=E8=AF=86?= =?UTF-8?q?=E5=88=ABQHBoxLayout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CUIProperty/CUIComponentBaseWidget.cpp | 21 +++++++------------ .../CUIProperty/CUIContainerGroupBox.cpp | 16 +++++++------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/CFDStruct/CUIProperty/CUIComponentBaseWidget.cpp b/CFDStruct/CUIProperty/CUIComponentBaseWidget.cpp index ac14bbc..76ca037 100644 --- a/CFDStruct/CUIProperty/CUIComponentBaseWidget.cpp +++ b/CFDStruct/CUIProperty/CUIComponentBaseWidget.cpp @@ -1,23 +1,21 @@ #include "CUIComponentBaseWidget.h" #include "CUIConfig.h" -#include #include +#include -CUIComponentBaseWidget::CUIComponentBaseWidget(QWidget *parent) : QWidget(parent) -{ +CUIComponentBaseWidget::CUIComponentBaseWidget(QWidget *parent) : QWidget(parent) { } -QLayout *CUIComponentBaseWidget::getLayout(CUIConfig *conf) -{ +QLayout *CUIComponentBaseWidget::getLayout(CUIConfig *conf) { if (!conf) { return new QVBoxLayout; } - QLayout* layout; + QLayout *layout; QString layoutConf = conf->getPropertyValue("layout"); if (layoutConf == "QVBoxLayout") { layout = new QVBoxLayout; - } else if (layoutConf == "QVBoxLayout") { + } else if (layoutConf == "QHBoxLayout") { layout = new QHBoxLayout; } else { layout = new QVBoxLayout; @@ -27,15 +25,12 @@ QLayout *CUIComponentBaseWidget::getLayout(CUIConfig *conf) return layout; } -void CUIComponentBaseWidget::initUI() -{ +void CUIComponentBaseWidget::initUI() { } -qint32 CUIComponentBaseWidget::getLabelWidth() -{ +qint32 CUIComponentBaseWidget::getLabelWidth() { return 100; } -void CUIComponentBaseWidget::setLabelWidth(qint32 width) -{ +void CUIComponentBaseWidget::setLabelWidth(qint32 width) { } diff --git a/CFDStruct/CUIProperty/CUIContainerGroupBox.cpp b/CFDStruct/CUIProperty/CUIContainerGroupBox.cpp index 00a2b0f..d17f060 100644 --- a/CFDStruct/CUIProperty/CUIContainerGroupBox.cpp +++ b/CFDStruct/CUIProperty/CUIContainerGroupBox.cpp @@ -12,11 +12,10 @@ * @param conf * @param parent */ -CUIContainerGroupBox::CUIContainerGroupBox(CUIConfig* conf, - QVector& subCUI, - QWidget* parent) - : CUIComponentBaseContainerWidget(parent) -{ +CUIContainerGroupBox::CUIContainerGroupBox(CUIConfig *conf, + QVector &subCUI, + QWidget *parent) + : CUIComponentBaseContainerWidget(parent) { this->m_conf = conf; initUI(subCUI); } @@ -24,18 +23,17 @@ CUIContainerGroupBox::CUIContainerGroupBox(CUIConfig* conf, /** * @brief CUIContainerGroupBox::initUI 根据配置信息进行初始化 */ -void CUIContainerGroupBox::initUI(QVector& subCUI) -{ +void CUIContainerGroupBox::initUI(QVector &subCUI) { m_groupBox = new QGroupBox; m_groupBox->setTitle(m_conf->getPropertyValue("name")); m_layout = this->getLayout(m_conf); m_groupBox->setLayout(m_layout); for (auto conf : this->m_conf->getSub()) { - CUIPropertyWidget* tmp = new CUIPropertyWidget(nullptr, conf); + CUIPropertyWidget *tmp = new CUIPropertyWidget(nullptr, conf); subCUI.push_back(tmp); m_layout->addWidget(tmp->getUI()); } - QVBoxLayout* mainLayout = new QVBoxLayout; + QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(m_groupBox); this->setLayout(mainLayout); }