diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-03-12 13:47:26 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-08-25 16:07:36 +0200 |
commit | 30bb830fc1b73834f459becaa141d0f7a1afa51c (patch) | |
tree | df07071c81f39ba360cf1a272f2a12bd973e8d6d /src/widgets | |
parent | 7dce96220003e3fa3f932341aaecd8e7f55f4d95 (diff) |
OS X: Fix pan gestures.
The QPanGesture recognizer requires single-point touch events. The touch
implementation in Qt 4 would test Qt::WA_TouchPadAcceptSingleTouchEvents
and forward single touch events if set.
Making this work in Qt 5 is a little bit more involved since the platform
plugins don't know about widgets.
Change the Cocoa touch implementation to send single-point touch events
to QWidgetWindow windows only. Make QApplication forward single-point
touch events only if the target widget has the
Qt::WA_TouchPadAcceptSingleTouchEvents attribute set.
Task-number: QTBUG-35893
Change-Id: I68712a5e3efb4ece7a81ca42f49c412e525eeb3a
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 4818dd7eaa..42a1c0259d 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -4343,7 +4343,16 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, } Q_ASSERT(target.data() != 0); - StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[static_cast<QWidget *>(target.data())]; + QWidget *targetWidget = static_cast<QWidget *>(target.data()); + +#ifdef Q_OS_OSX + // Single-touch events are normally not sent unless WA_TouchPadAcceptSingleTouchEvents is set. + // In Qt 4 this check was in OS X-only coode. That behavior is preserved here by the #ifdef. + if (touchPoints.count() == 1 && !targetWidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents)) + continue; +#endif + + StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[targetWidget]; maskAndPoints.first |= touchPoint.state(); maskAndPoints.second.append(touchPoint); } |