diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-12-14 09:42:48 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-01-12 13:34:22 +0000 |
commit | 00c1ceb36864f1e73570cf93f1505ab9ad508518 (patch) | |
tree | 5bb6b7e59c44a345bdbcede19db900d6cd3a2484 /src/plugins | |
parent | 63487e956659e1bace51371a61bd54bba272ba8e (diff) |
QWindowsSystemTrayIcon: use high-dpi icons for notifications
Do not downscale the icon used for QSystemTrayIcon even though the msdn
documentation states that SM_CXICON/SM_CYICON should be used as the
size to avoid blurry icons in the notification.
Fixes: QTBUG-103825
Change-Id: I2d466e895254aa3c41682290cc7864632c57d5d7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 94809cdec004611bdb8531304e6c74761014876b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7c22796a976e354357191f43fb21ae5b9239425b)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/windows/qwindowssystemtrayicon.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp index 39069a651f..acad849a3d 100644 --- a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp +++ b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp @@ -215,24 +215,13 @@ void QWindowsSystemTrayIcon::showMessage(const QString &title, const QString &me qStringToLimitedWCharArray(title, tnd.szInfoTitle, 64); tnd.uID = q_uNOTIFYICONID; - tnd.dwInfoFlags = NIIF_USER; - - QSize size(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); - const QSize largeIcon(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); - const QSize more = icon.actualSize(largeIcon); - if (more.height() > (largeIcon.height() * 3/4) || more.width() > (largeIcon.width() * 3/4)) { - tnd.dwInfoFlags |= NIIF_LARGE_ICON; - size = largeIcon; - } + + const auto size = icon.actualSize(QSize(256, 256)); QPixmap pm = icon.pixmap(size); if (pm.isNull()) { tnd.dwInfoFlags = NIIF_INFO; } else { - if (pm.size() != size) { - qWarning("QSystemTrayIcon::showMessage: Wrong icon size (%dx%d), please add standard one: %dx%d", - pm.size().width(), pm.size().height(), size.width(), size.height()); - pm = pm.scaled(size, Qt::IgnoreAspectRatio); - } + tnd.dwInfoFlags = NIIF_USER | NIIF_LARGE_ICON; tnd.hBalloonIcon = qt_pixmapToWinHICON(pm); } tnd.hWnd = m_hwnd; |