Skip to content

Commit

Permalink
fix: 修复关于对话框在应用名称很长时内容有被截断的情况
Browse files Browse the repository at this point in the history
调整关于对话框布局

Log: 修复关于对话框在应用名称很长时内容有被截断的情况
Bug: https://pms.uniontech.com/bug-view-240835.html
Influence: 关于对话框布局
  • Loading branch information
Whale107 authored and kegechen committed Jan 30, 2024
1 parent 5b6dcd9 commit 87e5b36
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/widgets/daboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ void DAboutDialogPrivate::init()

logoLabel = new QLabel();
logoLabel->setContentsMargins(0, 0, 0, 0);
logoLabel->setAlignment(Qt::AlignCenter);

productNameLabel = new QLabel();
productNameLabel->setForegroundRole(QPalette::BrightText);
productNameLabel->setObjectName("ProductNameLabel");
productNameLabel->setWordWrap(true);
productNameLabel->setAlignment(Qt::AlignCenter);
DFontSizeManager *fontManager = DFontSizeManager::instance();
fontManager->bind(productNameLabel, DFontSizeManager::T5, QFont::Medium);

Expand Down Expand Up @@ -151,13 +154,25 @@ void DAboutDialogPrivate::init()
q->connect(licenseLabel, SIGNAL(linkActivated(QString)), q, SLOT(_q_onLinkActivated(QString)));
q->connect(acknowledgementLabel, SIGNAL(linkActivated(QString)), q, SLOT(_q_onLicenseActivated(QString)));

QScrollArea *productNameScrollArea = new QScrollArea;
productNameScrollArea->setMaximumHeight(50);
productNameScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
productNameScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
QPalette scrollPalette;

scrollPalette.setBrush(QPalette::Window, Qt::transparent);
productNameScrollArea->setFrameShape(QFrame::NoFrame);
productNameScrollArea->setWidget(productNameLabel);
productNameScrollArea->setWidgetResizable(true);
productNameScrollArea->setPalette(scrollPalette);

QVBoxLayout *leftVLayout = new QVBoxLayout;
leftVLayout->setContentsMargins(36, 10, 0, 0);
leftVLayout->setContentsMargins(0, 10, 0, 0);
leftVLayout->addWidget(logoLabel);
leftVLayout->addSpacing(8);
leftVLayout->addWidget(productNameLabel, 0, Qt::AlignCenter);
leftVLayout->addWidget(productNameScrollArea);
leftVLayout->addSpacing(16);
leftVLayout->addWidget(companyLogoLabel, 0, Qt::AlignCenter);
leftVLayout->addWidget(companyLogoLabel);
leftVLayout->addSpacing(3);
leftVLayout->addStretch(0);

Expand Down Expand Up @@ -186,9 +201,7 @@ void DAboutDialogPrivate::init()
rightScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
QWidget *rightContent = new QWidget;
rightContent->setLayout(rightVLayout);
QPalette scrollPalette;

scrollPalette.setBrush(QPalette::Window, Qt::transparent);
rightScrollArea->setFrameShape(QFrame::NoFrame);
rightScrollArea->setWidget(rightContent);
rightScrollArea->setWidgetResizable(true);
Expand All @@ -197,10 +210,10 @@ void DAboutDialogPrivate::init()
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->addLayout(leftVLayout);
mainLayout->addSpacing(56);
mainLayout->addWidget(rightScrollArea);
mainLayout->setMargin(0);
mainLayout->addLayout(leftVLayout, 2);
mainLayout->addSpacing(20);
mainLayout->addWidget(rightScrollArea, 3);

QWidget *mainContent = new QWidget;

Expand Down

0 comments on commit 87e5b36

Please sign in to comment.