diff options
author | Fabian Bumberger <fbumberger@rim.com> | 2013-03-11 14:41:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-11 16:09:19 +0200 |
commit | e9760f1559361c39f269fb89f1ebd01f6ee8378d (patch) | |
tree | 6e15d2e2d8243a54fd8a0992fd02fcec2cc19bfa /src/gui | |
parent | e81446141fe40e8c83b15bcb37a1a4fc6ac7948f (diff) | |
download | qtbase-e9760f1559361c39f269fb89f1ebd01f6ee8378d.tar.gz |
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 <fbumberger@rim.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c2e19ca2a8..432929fec5 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -602,6 +602,12 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking return false; } +bool QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled() +{ + return QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents) + && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool(); +} + /*! Returns the QWindow that receives events tied to focus, such as key events. @@ -2054,7 +2060,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To } QGuiApplication::sendSpontaneousEvent(w, &touchEvent); - if (!e->synthetic && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) { + if (!e->synthetic && !touchEvent.isAccepted() && synthesizeMouseFromTouchEventsEnabled()) { // exclude touchpads as those generate their own mouse events if (touchEvent.device()->type() != QTouchDevice::TouchPad) { Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton; diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 22d95b2121..376890ef47 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -191,6 +191,8 @@ public: static void updateBlockedStatus(QWindow *window); virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const; + static bool synthesizeMouseFromTouchEventsEnabled(); + static Qt::MouseButtons buttons; static ulong mousePressTime; static Qt::MouseButton mousePressButton; |