aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp34
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h14
-rw-r--r--tests/auto/qtquick2/qquickmultipointtoucharea/data/inFlickable.qml2
-rw-r--r--tests/auto/qtquick2/qquickmultipointtoucharea/data/signalTest.qml6
4 files changed, 36 insertions, 20 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 8f27f04273..d590d60d85 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -229,43 +229,43 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
*/
/*!
- \qmlsignal QtQuick2::MultiPointTouchArea::touchPointsPressed(list<TouchPoint> touchPoints)
+ \qmlsignal QtQuick2::MultiPointTouchArea::onPressed(list<TouchPoint> touchPoints)
This handler is called when new touch points are added. \a touchPoints is a list of these new points.
If minimumTouchPoints is set to a value greater than one, this handler will not be called until the minimum number
- of required touch points has been reached. At that point, touchPointsPressed will be called with all the current touch points.
+ of required touch points has been reached. At that point, onPressed will be called with all the current touch points.
*/
/*!
- \qmlsignal QtQuick2::MultiPointTouchArea::touchPointsUpdated(list<TouchPoint> touchPoints)
+ \qmlsignal QtQuick2::MultiPointTouchArea::onUpdated(list<TouchPoint> touchPoints)
This handler is called when existing touch points are updated. \a touchPoints is a list of these updated points.
*/
/*!
- \qmlsignal QtQuick2::MultiPointTouchArea::touchPointsReleased(list<TouchPoint> touchPoints)
+ \qmlsignal QtQuick2::MultiPointTouchArea::onReleased(list<TouchPoint> touchPoints)
This handler is called when existing touch points are removed. \a touchPoints is a list of these removed points.
*/
/*!
- \qmlsignal QtQuick2::MultiPointTouchArea::touchPointsCanceled(list<TouchPoint> touchPoints)
+ \qmlsignal QtQuick2::MultiPointTouchArea::onCanceled(list<TouchPoint> touchPoints)
This handler is called when new touch events have been canceled because another element stole the touch event handling.
This signal is for advanced use: it is useful when there is more than one MultiPointTouchArea
that is handling input, or when there is a MultiPointTouchArea inside a \l Flickable. In the latter
- case, if you execute some logic on the touchPointsPressed signal and then start dragging, the
+ case, if you execute some logic on the onPressed signal and then start dragging, the
\l Flickable may steal the touch handling from the MultiPointTouchArea. In these cases, to reset
the logic when the MultiPointTouchArea has lost the touch handling to the \l Flickable,
- \c onTouchPointsCanceled should be used in addition to onTouchPointsReleased.
+ \c onCanceled should be used in addition to onReleased.
\a touchPoints is the list of canceled points.
*/
/*!
- \qmlsignal QtQuick2::MultiPointTouchArea::gestureStarted(GestureEvent gesture)
+ \qmlsignal QtQuick2::MultiPointTouchArea::onGestureStarted(GestureEvent gesture)
This handler is called when the global drag threshold has been reached.
@@ -278,7 +278,7 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
*/
/*!
- \qmlsignal QtQuick2::MultiPointTouchArea::touchUpdated(list<TouchPoint> touchPoints)
+ \qmlsignal QtQuick2::MultiPointTouchArea::onTouchUpdated(list<TouchPoint> touchPoints)
This handler is called when the touch points handled by the MultiPointTouchArea change. This includes adding new touch points,
removing or canceling previous touch points, as well as updating current touch point data. \a touchPoints is the list of all current touch
@@ -477,9 +477,18 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
}
}
- if (ended) emit touchPointsReleased(_releasedTouchPoints);
- if (moved) emit touchPointsUpdated(_movedTouchPoints);
- if (started) emit touchPointsPressed(_pressedTouchPoints);
+ if (ended) {
+ emit released(_releasedTouchPoints);
+ emit touchPointsReleased(_releasedTouchPoints);
+ }
+ if (moved) {
+ emit updated(_movedTouchPoints);
+ emit touchPointsUpdated(_movedTouchPoints);
+ }
+ if (started) {
+ emit pressed(_pressedTouchPoints);
+ emit touchPointsPressed(_pressedTouchPoints);
+ }
if (ended || moved || started) emit touchUpdated(_touchPoints.values());
}
}
@@ -587,6 +596,7 @@ void QQuickMultiPointTouchArea::ungrab()
setKeepTouchGrab(false);
foreach (QObject *obj, _touchPoints)
static_cast<QQuickTouchPoint*>(obj)->setPressed(false);
+ emit canceled(_touchPoints.values());
emit touchPointsCanceled(_touchPoints.values());
clearTouchLists();
foreach (QObject *obj, _touchPoints) {
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h
index dbce42853b..d182ab85cf 100644
--- a/src/quick/items/qquickmultipointtoucharea_p.h
+++ b/src/quick/items/qquickmultipointtoucharea_p.h
@@ -217,15 +217,21 @@ public:
}
Q_SIGNALS:
- void touchPointsPressed(const QList<QObject*> &touchPoints);
- void touchPointsUpdated(const QList<QObject*> &touchPoints);
- void touchPointsReleased(const QList<QObject*> &touchPoints);
- void touchPointsCanceled(const QList<QObject*> &touchPoints);
+ void pressed(const QList<QObject*> &touchPoints);
+ void updated(const QList<QObject*> &touchPoints);
+ void released(const QList<QObject*> &touchPoints);
+ void canceled(const QList<QObject*> &touchPoints);
void gestureStarted(QQuickGrabGestureEvent *gesture);
void touchUpdated(const QList<QObject*> &touchPoints);
void minimumTouchPointsChanged();
void maximumTouchPointsChanged();
+ //### deprecated, will be removed for 5.0
+ void touchPointsPressed(const QList<QObject*> &touchPoints);
+ void touchPointsUpdated(const QList<QObject*> &touchPoints);
+ void touchPointsReleased(const QList<QObject*> &touchPoints);
+ void touchPointsCanceled(const QList<QObject*> &touchPoints);
+
protected:
void touchEvent(QTouchEvent *);
bool childMouseEventFilter(QQuickItem *i, QEvent *event);
diff --git a/tests/auto/qtquick2/qquickmultipointtoucharea/data/inFlickable.qml b/tests/auto/qtquick2/qquickmultipointtoucharea/data/inFlickable.qml
index 5db377011c..9c9132d0b0 100644
--- a/tests/auto/qtquick2/qquickmultipointtoucharea/data/inFlickable.qml
+++ b/tests/auto/qtquick2/qquickmultipointtoucharea/data/inFlickable.qml
@@ -24,7 +24,7 @@ Flickable {
TouchPoint { id: point2; objectName: "point2" }
]
- onTouchPointsCanceled: cancelCount = touchPoints.length
+ onCanceled: cancelCount = touchPoints.length
onTouchUpdated: touchCount = touchPoints.length
}
}
diff --git a/tests/auto/qtquick2/qquickmultipointtoucharea/data/signalTest.qml b/tests/auto/qtquick2/qquickmultipointtoucharea/data/signalTest.qml
index 85f8cd6f39..54b160c182 100644
--- a/tests/auto/qtquick2/qquickmultipointtoucharea/data/signalTest.qml
+++ b/tests/auto/qtquick2/qquickmultipointtoucharea/data/signalTest.qml
@@ -20,9 +20,9 @@ MultiPointTouchArea {
maximumTouchPoints: 5
- onTouchPointsPressed: { touchPointPressCount = touchPoints.length }
- onTouchPointsUpdated: { touchPointUpdateCount = touchPoints.length }
- onTouchPointsReleased: { touchPointReleaseCount = touchPoints.length }
+ onPressed: { touchPointPressCount = touchPoints.length }
+ onUpdated: { touchPointUpdateCount = touchPoints.length }
+ onReleased: { touchPointReleaseCount = touchPoints.length }
onTouchUpdated: {
touchCount = touchPoints.length
touchUpdatedHandled = true