From e9760f1559361c39f269fb89f1ebd01f6ee8378d Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Mon, 11 Mar 2013 14:41:52 +0100 Subject: Fix the check if mouse events should be synthesized from touch events In QGuiApplication only Qt::AA_SynthesizeMouseForUnhandledTouchEvents is taken into account when synthesizing mouse from touch events, in QApplication only the PlatformIntegration syle hint QPlatformIntegration::SynthesizeMouseFromTouchEvents. With this patch both attributes are checked. Furthermore the check was moved out of translateTouchToMouse in QApplication in order not to influence the result which is returned to the user, when mouse events are not be synthesized. Change-Id: I87ac7299f0a9fbf0a083eff9c547f0dbfab75dfb Reviewed-by: Fabian Bumberger Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qapplication.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/widgets/kernel/qapplication.cpp') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ac25d3ed7f..02fcfde59e 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3210,7 +3210,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = acceptTouchEvents && d->notify_helper(widget, touchEvent); // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. - if (!touchEvent->isAccepted()) + if (!touchEvent->isAccepted() && QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()) res = d->translateTouchToMouse(widget, touchEvent); break; } @@ -3237,7 +3237,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = acceptTouchEvents && d->notify_helper(widget, touchEvent); // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. - if (!touchEvent->isAccepted()) { + if (!touchEvent->isAccepted() && QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()) { res = d->translateTouchToMouse(widget, touchEvent); eventAccepted = touchEvent->isAccepted(); if (eventAccepted) @@ -3801,10 +3801,6 @@ private: bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *event) { - // Check if the platform wants synthesized mouse events. - if (!QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool()) - return false; - Q_FOREACH (const QTouchEvent::TouchPoint &p, event->touchPoints()) { const QEvent::Type eventType = (p.state() & Qt::TouchPointPressed) ? QEvent::MouseButtonPress : (p.state() & Qt::TouchPointReleased) ? QEvent::MouseButtonRelease -- cgit v1.2.3