summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-11-30 18:51:00 +0200
committerQt by Nokia <qt-info@nokia.com>2011-12-09 16:36:00 +0100
commit4471e45f74a74827464774480306c1fbd70a5d7e (patch)
treedf41701cbb5bae1b6776bc79d6ebbc414fe54d75 /src/gui
parent5da5230ab29743b63bf238a379891c98ac9d5038 (diff)
Remove QWidget dependency from QTouchEvent.
QWidget *widget() is replaced with QObject *target(). Change-Id: Ib2c860480764410cf1527662e89f352ff688b32a Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qevent.cpp22
-rw-r--r--src/gui/kernel/qevent.h6
2 files changed, 15 insertions, 13 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 035f1b2666..7ff7fc0f5d 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3467,7 +3467,8 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
Qt::TouchPointStates touchPointStates,
const QList<QTouchEvent::TouchPoint> &touchPoints)
: QInputEvent(eventType, modifiers),
- _widget(0),
+ _window(0),
+ _target(0),
_device(device),
_touchPointStates(touchPointStates),
_touchPoints(touchPoints)
@@ -3479,11 +3480,6 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
QTouchEvent::~QTouchEvent()
{ }
-/*! \fn QWidget *QTouchEvent::widget() const
-
- Returns the widget on which the event occurred.
-*/
-
/*! \fn QWindow *QTouchEvent::window() const
Returns the window on which the event occurred. Useful for doing
@@ -3492,6 +3488,12 @@ QTouchEvent::~QTouchEvent()
touch event.
*/
+/*! \fn QObject *QTouchEvent::target() const
+
+ Returns the target object within the window on which the event occurred.
+ This is typically a QWidget or a QQuickItem. May be 0 when no specific target is available.
+*/
+
/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}.
@@ -3521,18 +3523,18 @@ QTouchEvent::~QTouchEvent()
Returns the touch device from which this touch event originates.
*/
-/*! \fn void QTouchEvent::setWidget(QWidget *widget)
+/*! \fn void QTouchEvent::setWindow(QWindow *window)
\internal
- Sets the widget for this event.
+ Sets the window for this event.
*/
-/*! \fn void QTouchEvent::setWindow(QWindow *window)
+/*! \fn void QTouchEvent::setTarget(QObject *target)
\internal
- Sets the window for this event.
+ Sets the target within the window (typically a widget) for this event.
*/
/*! \fn void QTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates)
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 6a0442509c..7237b16df7 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -776,23 +776,23 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
~QTouchEvent();
- inline QWidget *widget() const { return _widget; }
inline QWindow *window() const { return _window; }
+ inline QObject *target() const { return _target; }
QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
inline QTouchDevice *device() const { return _device; }
// internal
- inline void setWidget(QWidget *awidget) { _widget = awidget; }
inline void setWindow(QWindow *awindow) { _window = awindow; }
+ inline void setTarget(QObject *atarget) { _target = atarget; }
inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
inline void setDevice(QTouchDevice *device) { _device = device; }
protected:
- QWidget *_widget;
QWindow *_window;
+ QObject *_target;
QTouchDevice *_device;
Qt::TouchPointStates _touchPointStates;
QList<QTouchEvent::TouchPoint> _touchPoints;