summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qwizard_win.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-15 14:02:29 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-17 07:12:52 +0200
commitbc98bc68901d08d66bfc81256dee7ff8cfa90459 (patch)
tree6816033016b9dc836ed22504931d92aa778274a0 /src/widgets/dialogs/qwizard_win.cpp
parentb3b9875695c216cea626844fb2fbba853d52c0be (diff)
QWizard/Windows: Fix deprecation warnings about old mouse event API
Fix: src/widgets/dialogs/qwizard_win.cpp:515 C4996: 'QMouseEvent::globalX': Use globalPosition() src/widgets/dialogs/qwizard_win.cpp:529 C4996: 'QMouseEvent::globalX': Use globalPosition() src/widgets/dialogs/qwizard_win.cpp:544 C4996: 'QMouseEvent::globalX': Use globalPosition() and add missing High DPI scaling for the native event on this occasion. Change-Id: Ib9a8ab0b3419fa0435eba38401b91c445acdb7bf Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/widgets/dialogs/qwizard_win.cpp')
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 1ec8fe8d91..5a666b542b 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -52,6 +52,7 @@
#include <QtCore/QDebug>
#include <QtGui/QMouseEvent>
#include <QtGui/QWindow>
+#include <QtGui/private/qhighdpiscaling_p.h>
#include <uxtheme.h>
#include <vssym32.h>
@@ -501,6 +502,12 @@ void QVistaHelper::mouseReleaseEvent(QMouseEvent *event)
event->ignore();
}
+static inline LPARAM pointToLParam(const QPointF &p, const QWidget *w)
+{
+ const auto point = QHighDpi::toNativePixels(p, w->screen()).toPoint();
+ return MAKELPARAM(point.x(), point.y());
+}
+
bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
{
if (obj != wizard)
@@ -512,7 +519,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
MSG msg;
msg.message = WM_NCHITTEST;
msg.wParam = 0;
- msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
+ msg.lParam = pointToLParam(mouseEvent->globalPosition(), wizard);
msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
@@ -526,7 +533,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
MSG msg;
msg.message = WM_NCHITTEST;
msg.wParam = 0;
- msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
+ msg.lParam = pointToLParam(mouseEvent->globalPosition(), wizard);
msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
@@ -541,7 +548,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
MSG msg;
msg.message = WM_NCHITTEST;
msg.wParam = 0;
- msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
+ msg.lParam = pointToLParam(mouseEvent->globalPosition(), wizard);
msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;