QMessageBox: Try to pass window handle to QIcon::pixmap().

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 <morten.sorvig@theqtcompany.com>
bb10
Friedemann Kleint 2016-04-19 15:47:01 +02:00
parent 5386a35d35
commit ff49c56450
1 changed files with 11 additions and 2 deletions

View File

@ -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();
}