diff --git a/CFDStruct/CUIProperty/CUI.cpp b/CFDStruct/CUIProperty/CUI.cpp index 1b9a961..f94fbe1 100644 --- a/CFDStruct/CUIProperty/CUI.cpp +++ b/CFDStruct/CUIProperty/CUI.cpp @@ -1,4 +1,4 @@ -#include "CUI.h" +#include "CUI.h" #include #include @@ -20,7 +20,6 @@ CUI::CUI(QWidget *parent, CUIConfig *conf): QWidget(parent) { this->conf = conf; -// this->conf->printConfig(); qDebug() << "----------------------"; buildUI(); } @@ -58,10 +57,12 @@ void CUI::buildUI() if (widget) { qDebug() << "----------- ui widget is not null"; QVBoxLayout *layout = new QVBoxLayout; + layout->setSpacing(0); + layout->setMargin(0); layout->addWidget(widget); this->setLayout(layout); -// QSpacerItem* spacer = new QSpacerItem(5000,5000,QSizePolicy::Maximum,QSizePolicy::Maximum); -// layout->addItem(spacer); +// QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); +// layout->addSpacerItem(verticalSpacer); } else { qDebug() << "----------- ui widget is null"; diff --git a/CFDStruct/CUIProperty/CUIWidget.cpp b/CFDStruct/CUIProperty/CUIWidget.cpp index e98d5d7..10482ce 100644 --- a/CFDStruct/CUIProperty/CUIWidget.cpp +++ b/CFDStruct/CUIProperty/CUIWidget.cpp @@ -1,4 +1,4 @@ -#include "CUIWidget.h" +#include "CUIWidget.h" #include "CUIConfig.h" #include "QVBoxLayout" #include @@ -29,6 +29,11 @@ void CUIWidget::iniUI(QVector &subCUI) subCUI.push_back(tmp); m_layout->addWidget(tmp->getUI()); } + // 如果是垂直布局,则添加 底部的弹簧 + if (qobject_cast(m_layout) != nullptr) { + QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + ((QVBoxLayout*)m_layout)->addSpacerItem(verticalSpacer); + } }