diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-05 14:49:21 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-05 14:49:21 (GMT) |
commit | 8d8b3e03cfc36c72665494eaa9bb461ff18072a0 (patch) | |
tree | 339041f1692b5f0fdef5a1558bd9534980bb2f4b /src/gui/kernel/qevent.h | |
parent | 12c315f34ca428c3da38716d2c071a8e94f2acf0 (diff) | |
download | Qt-8d8b3e03cfc36c72665494eaa9bb461ff18072a0.zip Qt-8d8b3e03cfc36c72665494eaa9bb461ff18072a0.tar.gz Qt-8d8b3e03cfc36c72665494eaa9bb461ff18072a0.tar.bz2 |
Some API changes after an API review round
1. Don't have QGraphicsSceneTouchEvent::TouchPoint inherit from
QTouchEvent::TouchPoint. The only reason to do this is to support an
implementation trick, which can be done another way (see below). This
means we have to essentially duplicate the API in the GraphicsScene
variant.
2. Don't use a list of pointers to touch points in QTouchEvent and
QGraphicsSceneTouchEvent. This means we have to make the TouchPoint
classes implicitly shared (and the effect of the previous trick of
static_casting the widget touch point to a graphics-scene touch point
can be emulated by sharing the d-pointers between the classes).
3. QEvent::RawTouch isn't really an event type, it's a
backdoor. Remove it and export the bool
qt_translateRawTouchEvent(QList<QTouchEvent::TouchPoint>, QWidget *)
function instead.
4. Rename QTouchEvent::TouchPoint::area() to size() (which is more
clear as to what the function
returns). QGraphicsSceneTouchEvent::TouchPoint gains size(),
sceneSize(), and screenSize() functions (the actual translation from
screen to scene to item still needs to be implemented).
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r-- | src/gui/kernel/qevent.h | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index f622126..0c4bbb7 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -765,6 +765,7 @@ public: { public: TouchPoint(int id = -1); + TouchPoint(const TouchPoint &other); ~TouchPoint(); int id() const; @@ -782,29 +783,33 @@ public: QPointF lastPos() const; void setLastPos(const QPointF &lastPos); - QPointF screenPos() const; - void setScreenPos(const QPointF &screenPos); + QPointF globalPos() const; + void setGlobalPos(const QPointF &globalPos); - QPointF startScreenPos() const; - void setStartScreenPos(const QPointF &startScreenPos); + QPointF startGlobalPos() const; + void setStartGlobalPos(const QPointF &startGlobalPos); - QPointF lastScreenPos() const; - void setLastScreenPos(const QPointF &lastScreenPos); + QPointF lastGlobalPos() const; + void setLastGlobalPos(const QPointF &lastGlobalPos); - QSizeF area() const; - void setArea(const QSizeF &area); + QSizeF size() const; + void setSize(const QSizeF &size); - qreal pressure() const; // 0.0 -> 1.0 + qreal pressure() const; void setPressure(qreal pressure); - protected: + TouchPoint &operator=(const TouchPoint &other); + + private: QTouchEventTouchPointPrivate *d; + + friend class QTouchEventTouchPointPrivate; }; QTouchEvent(QEvent::Type type, Qt::KeyboardModifiers modifiers, Qt::TouchPointStates touchPointStates, - const QList<QTouchEvent::TouchPoint *> &touchPoints); + const QList<QTouchEvent::TouchPoint> &touchPoints); ~QTouchEvent(); inline Qt::TouchPointStates touchPointStates() const @@ -816,18 +821,20 @@ public: _touchPointStates = touchPointStates; } - inline const QList<QTouchEvent::TouchPoint *> &touchPoints() const + inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; } - inline void setTouchPoints(const QList<QTouchEvent::TouchPoint *> &touchPoints) + inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &touchPoints) { _touchPoints = touchPoints; } protected: Qt::TouchPointStates _touchPointStates; - QList<QTouchEvent::TouchPoint *> _touchPoints; + QList<QTouchEvent::TouchPoint> _touchPoints; + + friend class QApplicationPrivate; }; QT_END_NAMESPACE |