summaryrefslogtreecommitdiff
path: root/src/gui/kernel/qevent_p.h
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-05 16:49:21 +0200
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-05 16:49:21 +0200
commit8d8b3e03cfc36c72665494eaa9bb461ff18072a0 (patch)
tree339041f1692b5f0fdef5a1558bd9534980bb2f4b /src/gui/kernel/qevent_p.h
parent12c315f34ca428c3da38716d2c071a8e94f2acf0 (diff)
downloadqt4-tools-8d8b3e03cfc36c72665494eaa9bb461ff18072a0.tar.gz
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_p.h')
-rw-r--r--src/gui/kernel/qevent_p.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 37a0ee7e47..573fdc86fa 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -93,18 +93,29 @@ class QTouchEventTouchPointPrivate
{
public:
inline QTouchEventTouchPointPrivate(int id)
- : id(id),
+ : ref(1),
+ id(id),
state(Qt::TouchPointReleased),
pressure(qreal(-1.))
{ }
+ inline QTouchEventTouchPointPrivate *detach()
+ {
+ QTouchEventTouchPointPrivate *d = new QTouchEventTouchPointPrivate(*this);
+ d->ref = 1;
+ return d;
+ }
+
+ QAtomicInt ref;
int id;
Qt::TouchPointState state;
QPointF pos, startPos, lastPos;
QPointF scenePos, startScenePos, lastScenePos;
QPointF screenPos, startScreenPos, lastScreenPos;
- QSizeF area;
+ QSizeF size, sceneSize, screenSize;
qreal pressure;
+
+ static QTouchEventTouchPointPrivate *get(const QTouchEvent::TouchPoint &tp);
};
QT_END_NAMESPACE