From c4b32c0d50a9a466ed5005689cbbc339c0355605 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Fri, 23 Oct 2020 14:08:27 +0200 Subject: [PATCH] Qt6 incompatibility --- src/controls/QskControlPrivate.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/controls/QskControlPrivate.cpp b/src/controls/QskControlPrivate.cpp index a3d3d009..e45900d5 100644 --- a/src/controls/QskControlPrivate.cpp +++ b/src/controls/QskControlPrivate.cpp @@ -13,6 +13,15 @@ static inline void qskSendEventTo( QObject* object, QEvent::Type type ) QCoreApplication::sendEvent( object, &event ); } +static inline QPointF qskScenePosition( const QMouseEvent* event ) +{ +#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) + return event->scenePosition(); +#else + return event->windowPos(); +#endif +} + /* Qt 5.12: sizeof( QQuickItemPrivate::ExtraData ) -> 184 @@ -204,7 +213,9 @@ bool QskControlPrivate::maybeGesture( QQuickItem* child, QEvent* event ) case QEvent::MouseButtonPress: { const auto mouseEvent = static_cast< const QMouseEvent* >( event ); - const QPointF pos = q->mapFromScene( mouseEvent->windowPos() ); + + auto pos = qskScenePosition( mouseEvent ); + pos = q->mapFromScene( pos ); if ( !q->gestureRect().contains( pos ) ) return false;