QErrorMessage: Honor devicePixelRatio for SP_MessageBoxInformation

Use QStyle::standardIcon() and retrieve the best icon based on the
current dpr instead standardPixmap() which does not know anything about
the dpr.

Change-Id: Icbc6fd0e7b14808aaa4f081ed5079c319207828a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Christian Ehrlicher 2024-02-16 22:11:40 +01:00
parent e379203aed
commit 8b7f9f696e
1 changed files with 3 additions and 1 deletions

View File

@ -257,7 +257,9 @@ QErrorMessage::QErrorMessage(QWidget * parent)
grid->setRowStretch(0, 42);
#if QT_CONFIG(messagebox)
d->icon->setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxInformation, nullptr, this));
const auto iconSize = style()->pixelMetric(QStyle::PM_MessageBoxIconSize, nullptr, this);
const auto icon = style()->standardIcon(QStyle::SP_MessageBoxInformation, nullptr, this);
d->icon->setPixmap(icon.pixmap(QSize(iconSize, iconSize), devicePixelRatio()));
d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
#endif
d->again->setChecked(true);