diff options
author | Morten Johan Sorvig <morten.sorvig@nokia.com> | 2012-08-08 11:44:39 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-22 07:01:17 +0200 |
commit | 6c1670d8c273819435867c42725c0db0eee597dc (patch) | |
tree | 9de8f59b14624cb8c9678fa47820771f95e5b9d4 /src/widgets/kernel | |
parent | 09dd19df5c4b708960e5aade568eb15d996ef200 (diff) |
Add hint for touch -> mouse event synthesizing
Commit 7808ec79 changes QApplication to synthesize
mouse events from (unhandled) touch events.
On Mac OS X this creates a conflict for two-finger
scroll swipes, which generates both touch events and
mouse wheel events: scrolling in QTextEdit will also
select the text.
Add a SynthesizeMouseFromTouchEvents platform style
hint that enables the event synthesising. Set to true
by default and false in Cocoa.
Change-Id: I1ffa5a141476aa38b81ce92a87eff676c7ec2276
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1fcd7b1fbc..d26804fddf 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -4105,6 +4105,10 @@ bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *ev { Q_Q(QApplication); + // 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 |