summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-05-13 13:25:53 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-05-13 13:31:18 (GMT)
commit7be95673a1266b306fd76cd43fe894f144b0e72d (patch)
treeaef19868cf9e62a9f2efa5d341cc50dfa9baa086 /src/gui/kernel/qevent.cpp
parentd9c2a93e1dc1ea0248d72fdc7f1bb863f8847658 (diff)
downloadQt-7be95673a1266b306fd76cd43fe894f144b0e72d.zip
Qt-7be95673a1266b306fd76cd43fe894f144b0e72d.tar.gz
Qt-7be95673a1266b306fd76cd43fe894f144b0e72d.tar.bz2
Support multiple touch targets in QGraphicsView
This required a larger change to the kernel and graphicsview directories to make this as efficient as possible: 1. QTouchEvent::TouchPoint becomes the base for QGraphicsSceneTouchEvent::TouchPoint - this means there is one private for every touch point, and we can store both the screen and scene coordinates in one place. Converting a QTouchEvent to QGraphicsSceneTouchEvent becomes nothing more than casting the QTouchEvent::TouchPoints to QGraphicsSceneTouchEvent::TouchPoints. 2. The logic that we use in QApplication to convert WM_TOUCH* messages to QTouchEvents is essentially duplicated (with some minor changes) to QGraphicsScene so that it can support mulitple touch item targets. I will have to investigate how I can perhaps merge some of the duplicated code. QEvent::GraphicsSceneTouchBegin propagation is not implemented yet, and will come in a later commit
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r--src/gui/kernel/qevent.cpp90
1 files changed, 75 insertions, 15 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 15f0511..35fe6a3 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3726,11 +3726,17 @@ void QGestureEvent::accept(const QString &type)
*/
QTouchEvent::QTouchEvent(QEvent::Type type,
Qt::KeyboardModifiers modifiers,
- const QList<TouchPoint *> &touchPoints)
+ const QList<QTouchEvent::TouchPoint *> &touchPoints)
: QInputEvent(type, modifiers), _touchPoints(touchPoints)
{ }
-/*! \fn const QList<QTouchEvent::TouchPoint *> &QTouchEvent::touchPoints() const
+/*!
+ Destroys the QTouchEvent.
+*/
+QTouchEvent::~QTouchEvent()
+{ }
+
+/*! \fn const QList<QTouchEvent::TouchPoint *> &QTouchEvent::TouchPoints() const
Returns the list of touch points contained in the touch event.
*/
@@ -3762,6 +3768,12 @@ int QTouchEvent::TouchPoint::id() const
return d->id;
}
+/*! \internal */
+void QTouchEvent::TouchPoint::setId(int id)
+{
+ d->id = id;
+}
+
/*!
Returns the current state of this touch point.
*/
@@ -3770,56 +3782,98 @@ Qt::TouchPointState QTouchEvent::TouchPoint::state() const
return d->state;
}
+/*! \internal */
+void QTouchEvent::TouchPoint::setState(Qt::TouchPointState state)
+{
+ d->state = state;
+}
+
/*!
Returns the position of this touch point, relative to the widget
- that received the event.
+ or item that received the event.
*/
-const QPointF &QTouchEvent::TouchPoint::pos() const
+QPointF QTouchEvent::TouchPoint::pos() const
{
return d->pos;
}
+/*! \internal */
+void QTouchEvent::TouchPoint::setPos(const QPointF &pos)
+{
+ d->pos = pos;
+}
+
/*!
Returns the starting position of this touch point, relative to the
widget that received the event.
*/
-const QPointF &QTouchEvent::TouchPoint::startPos() const
+QPointF QTouchEvent::TouchPoint::startPos() const
{
return d->startPos;
}
+/*! \internal */
+void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
+{
+ d->startPos = startPos;
+}
+
/*!
Returns the position of this touch point from the previous touch
event, relative to the widget that received the event.
*/
-const QPointF &QTouchEvent::TouchPoint::lastPos() const
+QPointF QTouchEvent::TouchPoint::lastPos() const
{
return d->lastPos;
}
+/*! \internal */
+void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
+{
+ d->lastPos = lastPos;
+}
+
/*!
- Returns the global position of this touch point.
+ Returns the screen position of this touch point.
*/
-const QPointF &QTouchEvent::TouchPoint::globalPos() const
+QPointF QTouchEvent::TouchPoint::screenPos() const
+{
+ return d->screenPos;
+}
+
+/*! \internal */
+void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
{
- return d->globalPos;
+ d->screenPos = screenPos;
}
/*!
- Returns the global starting position of this touch point.
+ Returns the starting screen position of this touch point.
*/
-const QPointF &QTouchEvent::TouchPoint::startGlobalPos() const
+QPointF QTouchEvent::TouchPoint::startScreenPos() const
+{
+ return d->startScreenPos;
+}
+
+/*! \internal */
+void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
{
- return d->startGlobalPos;
+ d->startScreenPos = startScreenPos;
}
/*!
- Returns the global position of this touch point from the previous
+ Returns the screen position of this touch point from the previous
touch event.
*/
-const QPointF &QTouchEvent::TouchPoint::lastGlobalPos() const
+QPointF QTouchEvent::TouchPoint::lastScreenPos() const
+{
+ return d->lastScreenPos;
+}
+
+/*! \internal */
+void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
{
- return d->lastGlobalPos;
+ d->lastScreenPos = lastScreenPos;
}
/*!
@@ -3831,4 +3885,10 @@ qreal QTouchEvent::TouchPoint::pressure() const
return d->pressure;
}
+/*! \internal */
+void QTouchEvent::TouchPoint::setPressure(qreal pressure)
+{
+ d->pressure = pressure;
+}
+
QT_END_NAMESPACE