diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-04-20 11:22:34 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-04-20 11:59:25 +0000 |
commit | e75bd17e3dd9dd07d4f2aa53ee9a7eb07ebe4bf8 (patch) | |
tree | e655c3c5692109474806afdd2c1ddc91e3a8d055 /src/plugins/platforms | |
parent | ff49c5645086272164ab9e8b16a7f4f733dcf54d (diff) |
QWindowsTheme::standardPixmap(): Do not create pixmaps with DPR.
The given size is mostly ignored and the resulting pixmaps typically end up
in a QIcon, which will clobber the DPR anyways when returning a pixmap
for a given size.
Moreover, returning a message box icon with a DPR > 1 when
high DPI scaling is active and Qt::AA_UseHighDpiPixmaps is not set
causes the pixmap to become too small due to some scaling error.
Task-number: QTBUG-52622
Change-Id: I8aaaa97667d6c168040e19b7edad9dfb7517f70f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowstheme.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index ef652e6f98..4a13f646f2 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -503,11 +503,8 @@ static QPixmap loadIconFromShell32(int resourceId, QSizeF size) return QPixmap(); } -QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const +QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSize) const { - const QScreen *primaryScreen = QGuiApplication::primaryScreen(); - const int scaleFactor = primaryScreen ? qRound(QHighDpiScaling::factor(primaryScreen)) : 1; - const QSizeF pixmapSize = size * scaleFactor; int resourceId = -1; LPCTSTR iconName = 0; switch (sp) { @@ -577,7 +574,6 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con const int iconSize = pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON; if (QWindowsContext::shell32dll.sHGetStockIconInfo(SIID_SHIELD, SHGFI_ICON | iconSize, &iconInfo) == S_OK) { pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon); - pixmap.setDevicePixelRatio(scaleFactor); DestroyIcon(iconInfo.hIcon); return pixmap; } @@ -596,7 +592,6 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con QPixmap link = loadIconFromShell32(30, pixmapSize); painter.drawPixmap(0, 0, int(pixmapSize.width()), int(pixmapSize.height()), link); } - pixmap.setDevicePixelRatio(scaleFactor); return pixmap; } } @@ -604,13 +599,12 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con if (iconName) { HICON iconHandle = LoadIcon(NULL, iconName); QPixmap pixmap = qt_pixmapFromWinHICON(iconHandle); - pixmap.setDevicePixelRatio(scaleFactor); DestroyIcon(iconHandle); if (!pixmap.isNull()) return pixmap; } - return QPlatformTheme::standardPixmap(sp, size); + return QPlatformTheme::standardPixmap(sp, pixmapSize); } enum { // Shell image list ids |