1、修改CUIComponentBaseWidget中,layout设置的错误:不能正确识别QHBoxLayout

feature/struct-menu-20241023
mzh 1 week ago
parent 7070440bad
commit 341481b9e4

@ -1,15 +1,13 @@
#include "CUIComponentBaseWidget.h"
#include "CUIConfig.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QVBoxLayout>
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;
}
@ -17,7 +15,7 @@ QLayout *CUIComponentBaseWidget::getLayout(CUIConfig *conf)
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) {
}

@ -15,8 +15,7 @@
CUIContainerGroupBox::CUIContainerGroupBox(CUIConfig *conf,
QVector<CUIPropertyWidget *> &subCUI,
QWidget *parent)
: CUIComponentBaseContainerWidget(parent)
{
: CUIComponentBaseContainerWidget(parent) {
this->m_conf = conf;
initUI(subCUI);
}
@ -24,8 +23,7 @@ CUIContainerGroupBox::CUIContainerGroupBox(CUIConfig* conf,
/**
* @brief CUIContainerGroupBox::initUI
*/
void CUIContainerGroupBox::initUI(QVector<CUIPropertyWidget*>& subCUI)
{
void CUIContainerGroupBox::initUI(QVector<CUIPropertyWidget *> &subCUI) {
m_groupBox = new QGroupBox;
m_groupBox->setTitle(m_conf->getPropertyValue("name"));
m_layout = this->getLayout(m_conf);

Loading…
Cancel
Save