@@ -95,11 +95,19 @@ bool MoveWindowHelper::windowEvent(QWindow *w, QEvent *event)
9595 isTouchDown = false ;
9696 }
9797 if (isTouchDown && event->type () == QEvent::MouseButtonPress) {
98+ #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
99+ touchBeginPosition = static_cast <QMouseEvent*>(event)->globalPosition ();
100+ #else
98101 touchBeginPosition = static_cast <QMouseEvent*>(event)->globalPos ();
102+ #endif
99103 }
100104 // add some redundancy to distinguish trigger between system menu and system move
101105 if (event->type () == QEvent::MouseMove) {
106+ #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
107+ QPointF currentPos = static_cast <QMouseEvent*>(event)->globalPosition ();
108+ #else
102109 QPointF currentPos = static_cast <QMouseEvent*>(event)->globalPos ();
110+ #endif
103111 QPointF delta = touchBeginPosition - currentPos;
104112 if (delta.manhattanLength () < QGuiApplication::styleHints ()->startDragDistance ()) {
105113 return DVtableHook::callOriginalFun (w, &QWindow::event, event);
@@ -123,8 +131,13 @@ bool MoveWindowHelper::windowEvent(QWindow *w, QEvent *event)
123131 self->m_windowMoving = false ;
124132 }
125133
134+ #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
135+ if (is_mouse_move && !event->isAccepted ()
136+ && w->geometry ().contains (static_cast <QMouseEvent*>(event)->globalPosition ().toPoint ())) {
137+ #else
126138 if (is_mouse_move && !event->isAccepted ()
127139 && w->geometry ().contains (static_cast <QMouseEvent*>(event)->globalPos ())) {
140+ #endif
128141 if (!self->m_windowMoving && self->m_enableSystemMove ) {
129142 self->m_windowMoving = true ;
130143
0 commit comments