Windows: Use pixmaps at 1.0 scale for icons in the QPA menus
The Menu type from Qt Quick's libs.platform module on Windows uses the Win32-based menus implemented in the Windows QPA backend. Those are not High-DPI aware, so we cannot use a scaled up pixmap for the menu icons. The native Windows icon engine returns scaled pixmaps (defaulting to the QGuiApplication::devicePixelRatio value if not explicitly specified), so we have to explicitly ask for pixmaps with scale factor 1.0. Pick-to: 6.7 Fixes: QTBUG-127551 Change-Id: I191915127890ae265b169d5cd8d6c9f058e36a13 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit fdfb360f4f60cbdb9ce7f29f424dad70f0679b17) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
5aafe2851f
commit
0f89dbb571
@ -235,7 +235,9 @@ void QWindowsMenuItem::updateBitmap()
|
|||||||
freeBitmap();
|
freeBitmap();
|
||||||
if (!m_icon.isNull()) {
|
if (!m_icon.isNull()) {
|
||||||
const int size = m_iconSize ? m_iconSize : GetSystemMetrics(SM_CYMENUCHECK);
|
const int size = m_iconSize ? m_iconSize : GetSystemMetrics(SM_CYMENUCHECK);
|
||||||
m_hbitmap = qt_pixmapToWinHBITMAP(m_icon.pixmap(QSize(size, size)), 1);
|
// native Win32 menus don't support high-DPI versions of icons, so always
|
||||||
|
// use the pixmap for a 1.0 scale factor.
|
||||||
|
m_hbitmap = qt_pixmapToWinHBITMAP(m_icon.pixmap(QSize(size, size), 1.0), 1);
|
||||||
}
|
}
|
||||||
MENUITEMINFO itemInfo;
|
MENUITEMINFO itemInfo;
|
||||||
menuItemInfoInit(itemInfo);
|
menuItemInfoInit(itemInfo);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user