You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include "CUIWidget.h"
|
|
|
|
|
#include "CUIConfig.h"
|
|
|
|
|
#include "QVBoxLayout"
|
|
|
|
|
#include <QLayout>
|
|
|
|
|
#include <CUI.h>
|
|
|
|
|
#include<QDebug>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief CUIWidget::CUIWidget 构造函数
|
|
|
|
|
* @param conf 配置信息
|
|
|
|
|
* @param parent
|
|
|
|
|
*/
|
|
|
|
|
CUIWidget::CUIWidget(CUIConfig *conf, QVector<CUI*> &subCUI, QWidget *parent): CUIComponentBaseContainerWidget(parent)
|
|
|
|
|
{
|
|
|
|
|
this->m_conf = conf;
|
|
|
|
|
iniUI(subCUI);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief CUIWidget::iniUI 根据配置信息初始化
|
|
|
|
|
*/
|
|
|
|
|
void CUIWidget::iniUI(QVector<CUI*> &subCUI)
|
|
|
|
|
{
|
|
|
|
|
m_layout = this->getLayout(m_conf);
|
|
|
|
|
this->setLayout(m_layout);
|
|
|
|
|
for(auto &conf : this->m_conf->getSub()) {
|
|
|
|
|
CUI* tmp = new CUI(nullptr, conf);
|
|
|
|
|
subCUI.push_back(tmp);
|
|
|
|
|
m_layout->addWidget(tmp->getUI());
|
|
|
|
|
}
|
|
|
|
|
// 如果是垂直布局,则添加 底部的弹簧
|
|
|
|
|
if (qobject_cast<QVBoxLayout * >(m_layout) != nullptr) {
|
|
|
|
|
QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
|
|
|
((QVBoxLayout*)m_layout)->addSpacerItem(verticalSpacer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|