summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicssceneevent.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-11 12:00:50 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-11 12:00:50 (GMT)
commitecc7f07e612bf156afb7fa2dbcbd2288b9b32e79 (patch)
tree88bbdcb558ef7337d3d3621b3b706f004505c569 /src/gui/graphicsview/qgraphicssceneevent.cpp
parent666299f9074235185aa7372729c84a2639224601 (diff)
downloadQt-ecc7f07e612bf156afb7fa2dbcbd2288b9b32e79.zip
Qt-ecc7f07e612bf156afb7fa2dbcbd2288b9b32e79.tar.gz
Qt-ecc7f07e612bf156afb7fa2dbcbd2288b9b32e79.tar.bz2
remove duplicated code and API (merge QTouchEvent and QGraphicsSceneTouchEvent)
the API for these 2 classes is identical, the implementation is almost identical, they share the same data structures, so bite the bullet and merge them. this means we go back to using screenPos() instead of globalPos() again
Diffstat (limited to 'src/gui/graphicsview/qgraphicssceneevent.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicssceneevent.cpp402
1 files changed, 0 insertions, 402 deletions
diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp
index 1be8d0d..bf82dd4 100644
--- a/src/gui/graphicsview/qgraphicssceneevent.cpp
+++ b/src/gui/graphicsview/qgraphicssceneevent.cpp
@@ -257,37 +257,6 @@
QGraphicsItem::ItemPositionHasChanged
*/
-/*!
- \class QGraphicsSceneTouchEvent
- \brief The QGraphicsSceneTouchEvent class provides touch events in the graphics view framework.
- \since 4.6
- \ingroup multimedia
- \ingroup graphicsview-api
-
- When a QGraphicsView receives a QTouchEvent, it translates it to a
- QGraphicsSceneTouchEvent. The event is then forwarded to the
- QGraphicsScene associated with the view.
-
- The touchPoints() function returns a list of touch points for the
- event. In addition to containing the item, scene, and screen
- coordinates, each touch point also contains its starting and
- previous coordinates.
-
- \sa QTouchEvent
-*/
-
-/*!
- \class QGraphicsSceneTouchEvent::TouchPoint
- \brief The QGraphicsSceneTouchEvent::TouchPoint class represents a single touch point in a QGraphicsSceneTouchEvent.
- \since 4.6
- \ingroup multimedia
- \ingroup graphicsview-api
-
- Each touch point in a QGraphicsSceneTouchEvent has an id() and
- state() in addition to current, starting, and previous coordinates
- for the touch point in item, scene, and screen coordinates.
-*/
-
#include "qgraphicssceneevent.h"
#ifndef QT_NO_GRAPHICSVIEW
@@ -1952,377 +1921,6 @@ void QGraphicsSceneGestureEvent::accept(const QString &type)
g->accept();
}
-class QGraphicsSceneTouchEventPrivate : public QGraphicsSceneEventPrivate
-{
- Q_DECLARE_PUBLIC(QGraphicsSceneTouchEvent)
-public:
- inline QGraphicsSceneTouchEventPrivate()
- : modifiers(Qt::NoModifier), touchPointStates()
- { }
-
- Qt::KeyboardModifiers modifiers;
- Qt::TouchPointStates touchPointStates;
- QList<QGraphicsSceneTouchEvent::TouchPoint> touchPoints;
-};
-
-/*!
- \internal
-
- Constructs a generic QGraphicsSceneTouchEvent of type \a type.
-*/
-QGraphicsSceneTouchEvent::QGraphicsSceneTouchEvent(Type type)
- : QGraphicsSceneEvent(*new QGraphicsSceneTouchEventPrivate, type)
-{ }
-
-/*!
- Destroys the QGraphicsSceneTouchEvent.
-*/
-QGraphicsSceneTouchEvent::~QGraphicsSceneTouchEvent()
-{ }
-
-/*!
- Returns the keyboard modifiers in use at the time the event was
- sent.
-*/
-Qt::KeyboardModifiers QGraphicsSceneTouchEvent::modifiers() const
-{
- Q_D(const QGraphicsSceneTouchEvent);
- return d->modifiers;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::setModifiers(Qt::KeyboardModifiers modifiers)
-{
- Q_D(QGraphicsSceneTouchEvent);
- d->modifiers = modifiers;
-}
-
-/*!
- Returns a bitwise OR of all of the touch point states at the time
- the event was sent.
-*/
-Qt::TouchPointStates QGraphicsSceneTouchEvent::touchPointStates() const
-{
- Q_D(const QGraphicsSceneTouchEvent);
- return d->touchPointStates;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates)
-{
- Q_D(QGraphicsSceneTouchEvent);
- d->touchPointStates = touchPointStates;
-}
-
-/*!
- Returns the list of touch points for this event.
-
- \sa QGraphicsSceneTouchEvent::TouchPoint
-*/
-const QList<QGraphicsSceneTouchEvent::TouchPoint> &QGraphicsSceneTouchEvent::touchPoints() const
-{
- Q_D(const QGraphicsSceneTouchEvent);
- return d->touchPoints;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::setTouchPoints(const QList<QGraphicsSceneTouchEvent::TouchPoint> &touchPoints)
-{
- Q_D(QGraphicsSceneTouchEvent);
- d->touchPoints = touchPoints;
-}
-
-/*! \internal */
-QGraphicsSceneTouchEvent::TouchPoint::TouchPoint(int id)
- : d(new QTouchEventTouchPointPrivate(id))
-{ }
-
-/*! \internal */
-QGraphicsSceneTouchEvent::TouchPoint::TouchPoint(const QGraphicsSceneTouchEvent::TouchPoint &other)
- : d(other.d)
-{
- d->ref.ref();
-}
-
-/*! \internal */
-QGraphicsSceneTouchEvent::TouchPoint::TouchPoint(QTouchEventTouchPointPrivate *dd)
- : d(dd)
-{
- d->ref.ref();
-}
-
-/*! \internal */
-QGraphicsSceneTouchEvent::TouchPoint::~TouchPoint()
-{
- if (!d->ref.deref())
- delete d;
-}
-
-/*!
- Returns the id number of this touch point.
-
- Id numbers are globally sequential, starting at zero, meaning the
- first touch point in the application has id 0, the second has id 1,
- and so on.
-*/
-int QGraphicsSceneTouchEvent::TouchPoint::id() const
-{
- return d->id;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setId(int id)
-{
- if (!d->ref == 1)
- d = d->detach();
- d->id = id;
-}
-
-/*!
- Returns the current state of this touch point.
-*/
-Qt::TouchPointState QGraphicsSceneTouchEvent::TouchPoint::state() const
-{
- return d->state;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setState(Qt::TouchPointState state)
-{
- if (d->ref != 1)
- d = d->detach();
- d->state = state;
-}
-
-/*!
- Returns the position of this touch point, relative to the widget
- or item that received the event.
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::pos() const
-{
- return d->pos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setPos(const QPointF &pos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->pos = pos;
-}
-
-/*!
- Returns the starting position of this touch point, relative to the
- widget that received the event.
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::startPos() const
-{
- return d->startPos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->startPos = startPos;
-}
-
-/*!
- Returns the position of this touch point from the previous touch
- event, relative to the widget that received the event.
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::lastPos() const
-{
- return d->lastPos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->lastPos = lastPos;
-}
-
-/*!
- Returns the current position of this touch point in scene coordinates.
-
- \sa pos(), screenPos()
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::scenePos() const
-{
- return d->scenePos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->scenePos = scenePos;
-}
-
-/*!
- Returns the starting position of this touch point in scene coordinates.
-
- \sa startPos(), startScreenPos()
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::startScenePos() const
-{
- return d->startScenePos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->startScenePos = startScenePos;
-}
-
-/*!
- Returns the previous position of this touch point in scene coordinates.
-
- \sa lastPos(), lastScreenPos()
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::lastScenePos() const
-{
- return d->lastScenePos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->lastScenePos = lastScenePos;
-}
-
-/*!
- Returns the screen position of this touch point.
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::screenPos() const
-{
- return d->screenPos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->screenPos = screenPos;
-}
-
-/*!
- Returns the starting screen position of this touch point.
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::startScreenPos() const
-{
- return d->startScreenPos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->startScreenPos = startScreenPos;
-}
-
-/*!
- Returns the screen position of this touch point from the previous
- touch event.
-*/
-QPointF QGraphicsSceneTouchEvent::TouchPoint::lastScreenPos() const
-{
- return d->lastScreenPos;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
-{
- if (d->ref != 1)
- d = d->detach();
- d->lastScreenPos = lastScreenPos;
-}
-
-/*!
- Returns the rect for this touch point.
-*/
-QRectF QGraphicsSceneTouchEvent::TouchPoint::rect() const
-{
- return d->rect;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setRect(const QRectF &rect)
-{
- if (d->ref != 1)
- d = d->detach();
- d->rect = rect;
-}
-
-/*!
- Returns the rect of this touch point in scene coordinates.
-*/
-QRectF QGraphicsSceneTouchEvent::TouchPoint::sceneRect() const
-{
- return d->sceneRect;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect)
-{
- if (d->ref != 1)
- d = d->detach();
- d->sceneRect = sceneRect;
-}
-
-/*!
- Returns the rect of this touch point in screen coordinates.
-*/
-QRectF QGraphicsSceneTouchEvent::TouchPoint::screenRect() const
-{
- return d->screenRect;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect)
-{
- if (d->ref != 1)
- d = d->detach();
- d->screenRect = screenRect;
-}
-
-/*!
- Returns the pressure of this touch point. The return value is in
- the range 0.0 to 1.0.
-*/
-qreal QGraphicsSceneTouchEvent::TouchPoint::pressure() const
-{
- return d->pressure;
-}
-
-/*! \internal */
-void QGraphicsSceneTouchEvent::TouchPoint::setPressure(qreal pressure)
-{
- if (d->ref != 1)
- d = d->detach();
- d->pressure = pressure;
-}
-
-/*! \internal */
-QGraphicsSceneTouchEvent::TouchPoint &QGraphicsSceneTouchEvent::TouchPoint::operator=(const QGraphicsSceneTouchEvent::TouchPoint &other)
-{
- other.d->ref.ref();
- if (!d->ref.deref())
- delete d;
- d = other.d;
- return *this;
-}
-
QT_END_NAMESPACE
#endif // QT_NO_GRAPHICSVIEW