Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Dialog text disappear when using large font size. #214

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/deb-installer/model/deblistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,17 @@ void DebListModel::showHierarchicalVerifyWindow()
dialog->addButton(QString(tr("Proceed", "button")), true, DDialog::ButtonRecommend);
dialog->show();

// 拷贝自 ddialog.cpp 用于设置默认对话框高度,避免在大字号/高缩放比下显示不全,在 show() 之后调用。
QLabel *msgLabel = dialog->findChild<QLabel *>("MessageLabel");
if (msgLabel) {
auto dialogStyle = dialog->style();
if (dialogStyle) {
QSize sz = dialogStyle->itemTextRect(msgLabel->fontMetrics(), msgLabel->rect(),
Qt::TextWordWrap, false, msgLabel->text()).size();
msgLabel->setMinimumHeight(qMax(sz.height(), msgLabel->sizeHint().height()));
}
}

QPushButton *btnPorceed = qobject_cast<QPushButton *>(dialog->getButton(1));
btnPorceed->setFocusPolicy(Qt::TabFocus);
btnPorceed->setFocus();
Expand Down
Loading