🐞 fix(UI模块): 修改消息对话框布局

This commit is contained in:
huheng@kylinos.cn 2022-12-22 11:32:17 +08:00
parent 47be05a61b
commit 05f74c744e
1 changed files with 8 additions and 3 deletions

View File

@ -14,15 +14,20 @@ MessageDialog::MessageDialog(QWidget *parent) : kdk::KDialog(parent)
m_icon = new QLabel(this);
m_icon->resize(ICON_SIZE, ICON_SIZE);
QVBoxLayout *iconLayout = new QVBoxLayout;
iconLayout->setMargin(0);
iconLayout->setSpacing(0);
iconLayout->addWidget(m_icon);
iconLayout->addStretch();
m_textLayout = new QVBoxLayout;
m_textLayout->setMargin(0);
m_textLayout->setSpacing(0);
m_textLayout->addStretch();
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setMargin(0);
hLayout->setSpacing(0);
hLayout->addWidget(m_icon);
hLayout->addLayout(iconLayout);
hLayout->addSpacing(8);
hLayout->addLayout(m_textLayout);
hLayout->addStretch();
@ -45,7 +50,7 @@ MessageDialog::MessageDialog(QWidget *parent) : kdk::KDialog(parent)
void MessageDialog::setText(QString title, QString text)
{
m_titleLab = new QLabel(this);
m_titleLab->setAlignment(Qt::AlignLeft);
m_titleLab->setAlignment(Qt::AlignLeft | Qt::AlignTop);
m_titleLab->setText(title);
m_textLayout->addWidget(m_titleLab);
if (text.isEmpty()) {