summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicssceneevent.h
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/graphicsview/qgraphicssceneevent.h
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/graphicsview/qgraphicssceneevent.h')
-rw-r--r--src/gui/graphicsview/qgraphicssceneevent.h45
1 files changed, 7 insertions, 38 deletions
diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h
index 4b7065e..01cdab9 100644
--- a/src/gui/graphicsview/qgraphicssceneevent.h
+++ b/src/gui/graphicsview/qgraphicssceneevent.h
@@ -42,7 +42,7 @@
#ifndef QGRAPHICSSCENEEVENT_H
#define QGRAPHICSSCENEEVENT_H
-#include <QtCore/qcoreevent.h>
+#include <QtGui/qevent.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
#include <QtGui/qpolygon.h>
@@ -349,34 +349,12 @@ protected:
};
class QGraphicsSceneTouchEventPrivate;
-class QGraphicsSceneTouchEventTouchPointPrivate;
class Q_GUI_EXPORT QGraphicsSceneTouchEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneTouchEvent(Type type = None);
- ~QGraphicsSceneTouchEvent();
-
- class Q_GUI_EXPORT TouchPoint
+ class Q_GUI_EXPORT TouchPoint : public QTouchEvent::TouchPoint
{
public:
- TouchPoint();
- ~TouchPoint();
-
- int id() const;
- void setId(int id);
-
- Qt::TouchPointState state() const;
- void setState(Qt::TouchPointState state);
-
- QPointF pos() const;
- void setPos(const QPointF &pos);
-
- QPointF startPos() const;
- void setStartPos(const QPointF &startPos);
-
- QPointF lastPos() const;
- void setLastPos(const QPointF &lastPos);
-
QPointF scenePos() const;
void setScenePos(const QPointF &scenePos);
@@ -386,24 +364,15 @@ public:
QPointF lastScenePos() const;
void setLastScenePos(const QPointF &lastScenePos);
- QPointF screenPos() const;
- void setScreenPos(const QPointF &screenPos);
-
- QPointF startScreenPos() const;
- void setStartScreenPos(const QPointF &startScreenPos);
-
- QPointF lastScreenPos() const;
- void setLastScreenPos(const QPointF &lastScreenPos);
-
qreal pressure() const; // 0.0 -> 1.0
void setPressure(qreal pressure);
-
- private:
- QGraphicsSceneTouchEventTouchPointPrivate *d;
};
- const QList<TouchPoint *> &touchPoints() const;
- void setTouchPoints(const QList<TouchPoint *> &touchPoints);
+ QGraphicsSceneTouchEvent(Type type = None);
+ ~QGraphicsSceneTouchEvent();
+
+ const QList<QGraphicsSceneTouchEvent::TouchPoint *> &touchPoints() const;
+ void setTouchPoints(const QList<QGraphicsSceneTouchEvent::TouchPoint *> &touchPoints);
Qt::KeyboardModifiers modifiers() const;
void setModifiers(Qt::KeyboardModifiers modifiers);