workround for Qt < 5.10 added
This commit is contained in:
parent
ace07bd7dd
commit
f681e0e2db
@ -1545,7 +1545,7 @@ bool QskControl::childMouseEventFilter( QQuickItem* item, QEvent* event )
|
|||||||
|
|
||||||
if ( event->type() == QEvent::MouseButtonPress )
|
if ( event->type() == QEvent::MouseButtonPress )
|
||||||
{
|
{
|
||||||
auto me = static_cast< const QMouseEvent* >( event );
|
auto me = static_cast< QMouseEvent* >( event );
|
||||||
|
|
||||||
if ( me->source() == Qt::MouseEventSynthesizedByQt )
|
if ( me->source() == Qt::MouseEventSynthesizedByQt )
|
||||||
{
|
{
|
||||||
@ -1554,15 +1554,37 @@ bool QskControl::childMouseEventFilter( QQuickItem* item, QEvent* event )
|
|||||||
mouse events. For all versions < 5.10 those events are
|
mouse events. For all versions < 5.10 those events are
|
||||||
passed through childMouseEventFilter without doing the
|
passed through childMouseEventFilter without doing the
|
||||||
extra checks, that are done for real mouse events.
|
extra checks, that are done for real mouse events.
|
||||||
|
Furthermore the coordinates are relative
|
||||||
|
to this - not to item.
|
||||||
|
|
||||||
To avoid having a different behavior between using
|
To avoid having a different behavior between using
|
||||||
mouse and touch, we do those checks here.
|
mouse and touch, we do those checks here.
|
||||||
*/
|
*/
|
||||||
if ( !( item->acceptedMouseButtons() & me->button() ) )
|
|
||||||
|
auto itm = item;
|
||||||
|
auto pos = item->mapFromScene( me->windowPos() );
|
||||||
|
|
||||||
|
for ( itm = item; itm != this; itm = itm->parentItem() )
|
||||||
|
{
|
||||||
|
if ( itm->acceptedMouseButtons() & me->button() )
|
||||||
|
{
|
||||||
|
if ( itm->contains( pos ) )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos += QPointF( itm->x(), itm->y() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( itm != item )
|
||||||
|
{
|
||||||
|
if ( itm == this )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto pos = item->mapFromScene( me->windowPos() );
|
QScopedPointer<QMouseEvent> clonedEvent(
|
||||||
if ( !item->contains( pos ) )
|
QQuickWindowPrivate::cloneMouseEvent( me, &pos ) );
|
||||||
return false;
|
|
||||||
|
return d_func()->maybeGesture( itm, clonedEvent.data() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user