From ff49c5645086272164ab9e8b16a7f4f733dcf54d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 19 Apr 2016 15:47:01 +0200 Subject: QMessageBox: Try to pass window handle to QIcon::pixmap(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Try to find a window handle so that the pixmap matching the device pixel ratio of the screen can be found. Task-number: QTBUG-52622 Change-Id: Iccf3cea82065af5e055d3cd932cd0808b29b15dc Reviewed-by: Morten Johan Sørvig --- src/widgets/dialogs/qmessagebox.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/widgets/dialogs/qmessagebox.cpp') diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 8375624f71..dbbf6cdc71 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -2677,8 +2677,17 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb default: break; } - if (!tmpIcon.isNull()) - return tmpIcon.pixmap(iconSize, iconSize); + if (!tmpIcon.isNull()) { + QWindow *window = Q_NULLPTR; + if (mb) { + window = mb->windowHandle(); + if (!window) { + if (const QWidget *nativeParent = mb->nativeParentWidget()) + window = nativeParent->windowHandle(); + } + } + return tmpIcon.pixmap(window, QSize(iconSize, iconSize)); + } return QPixmap(); } -- cgit v1.2.3