summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-18 10:49:11 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-18 10:49:11 (GMT)
commit3b04dba36b31360d94583f382b9054bcdea0e2a7 (patch)
treef56d1329980987a21d0c457e21ebb99f820e3ef2 /src/gui/kernel/qevent.cpp
parent9756f523fd1c31192a87c65449434280a59b49f7 (diff)
downloadQt-3b04dba36b31360d94583f382b9054bcdea0e2a7.zip
Qt-3b04dba36b31360d94583f382b9054bcdea0e2a7.tar.gz
Qt-3b04dba36b31360d94583f382b9054bcdea0e2a7.tar.bz2
Change behavior of how touch and mouse events work together
We now send both types of events, i.e. accepting TouchBegin doesn't block mouse events anymore. We are also introducing the idea of a "primary" touch point, which is the one that the system is also generating mouse events for. This lets us reuse existing mouse event code while still being able to add multi-touch support.
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r--src/gui/kernel/qevent.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index c30de7f..c9b9bc8 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3724,6 +3724,9 @@ void QGestureEvent::accept(const QString &type)
\value TouchPointMoved The touch point moved.
\value TouchPointStationary The touch point did not move.
\value TouchPointReleased The touch point was released.
+
+ \omitvalue TouchPointStateMask
+ \omitvalue TouchPointPrimary
*/
/*! \class QTouchEvent::TouchPoint
@@ -3833,7 +3836,16 @@ int QTouchEvent::TouchPoint::id() const
*/
Qt::TouchPointState QTouchEvent::TouchPoint::state() const
{
- return d->state;
+ return Qt::TouchPointState(int(d->state) & Qt::TouchPointStateMask);
+}
+
+/*!
+ Returns true if this touch point is the primary touch point. The primary touch point is the
+ point for which the windowing system generates mouse events.
+*/
+bool QTouchEvent::TouchPoint::isPrimary() const
+{
+ return (d->state & Qt::TouchPointPrimary) != 0;
}
/*!
@@ -3956,7 +3968,7 @@ void QTouchEvent::TouchPoint::setId(int id)
}
/*! \internal */
-void QTouchEvent::TouchPoint::setState(Qt::TouchPointState state)
+void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
{
if (d->ref != 1)
d = d->detach();