summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-12-02 14:05:58 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-07 13:23:06 +0100
commit78d2a04a01dbb989c017843f9d6d1f0c485c0e86 (patch)
tree86ca9829847ac371097697b840c81112f3549e85
parente52239f525d59f965dbbc5dbe2c28314498690b0 (diff)
QSystemTrayIcon: Fix geometry() to work with scaling enabled
Add missing call to QHighDpi::fromNativePixels(), retrieving the screen from the menu. Task-number: QTBUG-79248 Change-Id: I9f358c8010615c3f96ed9dc3b6666013ae9a0ed9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--src/widgets/util/qsystemtrayicon_qpa.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/widgets/util/qsystemtrayicon_qpa.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp
index c0bf058681..f2b0819132 100644
--- a/src/widgets/util/qsystemtrayicon_qpa.cpp
+++ b/src/widgets/util/qsystemtrayicon_qpa.cpp
@@ -42,6 +42,7 @@
#include <QtGui/qpa/qplatformsystemtrayicon.h>
#include <qpa/qplatformtheme.h>
#include <private/qguiapplication_p.h>
+#include <private/qhighdpiscaling_p.h>
#include <QApplication>
#include <QStyle>
@@ -75,10 +76,14 @@ void QSystemTrayIconPrivate::remove_sys()
QRect QSystemTrayIconPrivate::geometry_sys() const
{
- if (qpa_sys)
- return qpa_sys->geometry();
- else
+ if (!qpa_sys)
return QRect();
+ auto screen = QGuiApplication::primaryScreen();
+#if QT_CONFIG(menu)
+ if (menu)
+ screen = menu->screen();
+#endif
+ return QHighDpi::fromNativePixels(qpa_sys->geometry(), screen);
}
void QSystemTrayIconPrivate::updateIcon_sys()