summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-02-16 22:11:40 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-02-19 21:09:30 +0100
commit8b7f9f696ee5fcadc6bc3c96c1ea222fa592e8b6 (patch)
tree6e02ec3b9ca55fd3e347b59f1fe64c753187c048
parente379203aedb0979146104f3f21b73cea87050f28 (diff)
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>
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index ed51480991..2b5681f79b 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -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);