diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index cddf2294..4fd561c3 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -1541,6 +1541,33 @@ bool QskControl::event( QEvent* event ) bool QskControl::childMouseEventFilter( QQuickItem* item, QEvent* event ) { +#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 ) + + if ( event->type() == QEvent::MouseButtonPress ) + { + auto me = static_cast< const QMouseEvent* >( event ); + + if ( me->source() == Qt::MouseEventSynthesizedByQt ) + { + /* + Unhandled touch events result in creating synthetic + mouse events. For all versions < 5.10 those events are + passed through childMouseEventFilter without doing the + extra checks, that are done for real mouse events. + To avoid having a different behavior between using + mouse and touch, we do those checks here. + */ + if ( !( item->acceptedMouseButtons() & me->button() ) ) + return false; + + const auto pos = item->mapFromScene( me->windowPos() ); + if ( !item->contains( pos ) ) + return false; + } + } + +#endif + return d_func()->maybeGesture( item, event ); }