path: root/src/plugins/platforms/cocoa/
diff options
authorTor Arne Vestbø <>2020-11-18 14:46:42 +0100
committerQt Cherry-pick Bot <>2020-11-20 18:05:08 +0000
commiteaad8fe730f4af8605a39a9f3319c14ebd11626d (patch)
treeb28a8bf0e5a8cd0020d7de56f35a855ea7ac4474 /src/plugins/platforms/cocoa/
parenta778580339427d745260db962e6f109739c5661f (diff)
macOS: Propagate device-pixel-ratio of system tray icon
When preparing a system tray icon on a system with a retina screen, we end up creating a full-height icon of height 44. If there's also a 1x screen available, macOS will scale down this image for us when presenting the icon on the 1 screen, but the downscale will fail to preserve the aspect ratio of the original image on Big Sur. Telling macOS which device-pixel-ratio the image has seems to fix this, and is the right thing to do in any case. Fixes: QTBUG-88600 Change-Id: Ic31def94d073da1b256bbfcaf5905f92c169f43d Reviewed-by: Alexandru Croitor <> (cherry picked from commit a6aaa2b7071b7666a807b450dc5738742f3cc9e0) Reviewed-by: Qt Cherry-pick Bot <>
Diffstat (limited to 'src/plugins/platforms/cocoa/')
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/ b/src/plugins/platforms/cocoa/
index 597cfa8318..ed26d3afea 100644
--- a/src/plugins/platforms/cocoa/
+++ b/src/plugins/platforms/cocoa/
@@ -226,6 +226,7 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon)
p.drawPixmap(r, pixmap);
+ fullHeightPixmap.setDevicePixelRatio(devicePixelRatio);
NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(fullHeightPixmap));
[nsimage setTemplate:icon.isMask()];