summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-23 10:45:26 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-23 10:45:26 (GMT)
commit5e21e9b357a51eb6b3fa349dccf63e33c621fc72 (patch)
treefad2769e30786b098c2986232e1bbd8bbeb69ebe /src/gui/kernel/qevent.cpp
parentf11f41fe9e507d1f3eb8994960f0226f229bc76c (diff)
downloadQt-5e21e9b357a51eb6b3fa349dccf63e33c621fc72.zip
Qt-5e21e9b357a51eb6b3fa349dccf63e33c621fc72.tar.gz
Qt-5e21e9b357a51eb6b3fa349dccf63e33c621fc72.tar.bz2
Add functions to report normalized positions in QTouchEvent::TouchPoint
This introduces normalizedPos(), startNormalizedPos(), and lastNormalizedPos() in QTouchEvent::TouchPoint, and must be set by the implementation before being fed into Qt. We are assuming and hoping that these functions will make it easier to implement certain types of gestures (especially on a touchpad).
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r--src/gui/kernel/qevent.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 9c990c3..759aeb9 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3873,6 +3873,15 @@ QPointF QTouchEvent::TouchPoint::screenPos() const
}
/*!
+ Returns the position of this touch point. The coordinates are normalized to size of the touch
+ device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
+*/
+QPointF QTouchEvent::TouchPoint::normalizedPos() const
+{
+ return d->normalizedPos;
+}
+
+/*!
Returns the starting position of this touch point, relative to the
widget that received the event.
*/
@@ -3898,6 +3907,15 @@ QPointF QTouchEvent::TouchPoint::startScreenPos() const
}
/*!
+ Returns the starting position of this touch point. The coordinates are normalized to size of
+ the touch device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
+*/
+QPointF QTouchEvent::TouchPoint::startNormalizedPos() const
+{
+ return d->startNormalizedPos;
+}
+
+/*!
Returns the position of this touch point from the previous touch
event, relative to the widget that received the event.
*/
@@ -3925,6 +3943,16 @@ QPointF QTouchEvent::TouchPoint::lastScreenPos() const
}
/*!
+ Returns the position of this touch point from the previous touch event. The coordinates are
+ normalized to size of the touch device, i.e. (0,0) is the top-left corner and (1,1) is the
+ bottom-right corner.
+*/
+QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const
+{
+ return d->lastNormalizedPos;
+}
+
+/*!
Returns the rect for this touch point. The rect is centered around the point returned by pos().
Note this function returns an empty rect if the device does not report touch point sizes.
*/
@@ -3999,6 +4027,14 @@ void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
}
/*! \internal */
+void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos)
+{
+ if (d->ref != 1)
+ d = d->detach();
+ d->normalizedPos = normalizedPos;
+}
+
+/*! \internal */
void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
{
if (d->ref != 1)
@@ -4023,6 +4059,14 @@ void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
}
/*! \internal */
+void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos)
+{
+ if (d->ref != 1)
+ d = d->detach();
+ d->startNormalizedPos = startNormalizedPos;
+}
+
+/*! \internal */
void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
{
if (d->ref != 1)
@@ -4047,6 +4091,14 @@ void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
}
/*! \internal */
+void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos)
+{
+ if (d->ref != 1)
+ d = d->detach();
+ d->lastNormalizedPos = lastNormalizedPos;
+}
+
+/*! \internal */
void QTouchEvent::TouchPoint::setRect(const QRectF &rect)
{
if (d->ref != 1)