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>
bb10
Friedemann Kleint 2019-12-02 14:05:58 +01:00
parent e52239f525
commit 78d2a04a01
1 changed files with 8 additions and 3 deletions

View File

@ -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()