QGraphicsView: ignore unhandeled touch events

When QGraphicsView has sceneInteractionAllowed == false (e.g
when dragMode == QGraphicsView::ScrollHandDrag), all touch
events are accepted. This is wrong, and will stop mouse synthesising
from happening on touch platforms. This in turn will make
ScrollHandDrag not work (since no mouse events will come through).

This patch will call QEvent::ignore() if the touch event isn't send
to the scene, which will cause a mouse event to be synthesised.

Note that according to http://doc.qt.digia.com/qq/qq11-events.html
the correct approach would probably be to just return 'false', rather
than calling QEvent::ignore(). But this logic is not followed
consistently elsewhere (e.g in QApplication::notify), so I choose
to follow what the code actually expects for this bugfix.

Change-Id: Ida777647134c41661bab156d7b164ebd882a6bb1
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Richard Moe Gustavsen 2013-05-02 12:55:01 +02:00 committed by The Qt Project
parent dd7058898c
commit 3c46b829f9

View File

@ -2938,6 +2938,8 @@ bool QGraphicsView::viewportEvent(QEvent *event)
touchEvent->setTarget(viewport());
QGraphicsViewPrivate::translateTouchEvent(d, touchEvent);
(void) QApplication::sendEvent(d->scene, touchEvent);
} else {
event->ignore();
}
return true;