workaround for wrong calls of childMouseEventFilter ( Qt < 5.10 )
This commit is contained in:
parent
422fb816bc
commit
63ee61879d
@ -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 );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user