QSystemTrayIcon/Windows: Fix position of context menu with High DPI scaling
Apply scale factor of screen. Task-number: QTBUG-63781 Change-Id: I1b5630edbdf6bb356955a7d70458a885af441953 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
2d4fe257ca
commit
e00b295344
@ -49,7 +49,9 @@
|
||||
|
||||
#include <private/qsystemlibrary_p.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include <qpa/qplatformscreen.h>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QHash>
|
||||
@ -335,6 +337,13 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
|
||||
Q_ASSERT(q_uNOTIFYICONID == HIWORD(m->lParam));
|
||||
message = LOWORD(m->lParam);
|
||||
gpos = QPoint(GET_X_LPARAM(m->wParam), GET_Y_LPARAM(m->wParam));
|
||||
// Drop this chunk when merging to 5.10; code has been moved to Windows QPA.
|
||||
if (const QScreen *primaryScreen = QGuiApplication::primaryScreen()) {
|
||||
if (const QPlatformScreen *screen = primaryScreen->handle()->screenForPosition(gpos)) {
|
||||
gpos = QHighDpi::fromNative(gpos, QHighDpiScaling::factor(screen),
|
||||
screen->geometry().topLeft());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Q_ASSERT(q_uNOTIFYICONID == m->wParam);
|
||||
message = m->lParam;
|
||||
|
Loading…
x
Reference in New Issue
Block a user