From 9e61464c9026c4b766e05ea8c784f8e6a615adba Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 22 Dec 2011 10:53:25 +1000 Subject: [PATCH] Add a pressed property to TouchPoint. Remove the valid property, and replace it with pressed. The semantics have changed slightly for a release -- pressed will immediately become false, whereas valid remained true until the next touch event. Also make sure touch information is correctly updated on release. Change-Id: Ic61e1b6884c67f19100a6f8fc218b8b05b291ff0 Reviewed-by: Alan Alpert --- src/quick/items/qquickmultipointtoucharea.cpp | 37 +-- src/quick/items/qquickmultipointtoucharea_p.h | 20 +- .../qquickmultipointtoucharea/data/basic.qml | 15 + .../tst_qquickmultipointtoucharea.cpp | 325 ++++++++++++++------- 4 files changed, 258 insertions(+), 139 deletions(-) create mode 100644 tests/auto/qtquick2/qquickmultipointtoucharea/data/basic.qml diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index c94abc6..78bc31f 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -124,19 +124,16 @@ void QQuickTouchPoint::setArea(const QRectF &area) } /*! - \qmlproperty bool QtQuick2::TouchPoint::valid + \qmlproperty bool QtQuick2::TouchPoint::pressed - This property holds whether the touch point is valid. - - An invalid touch point is one that has not yet been pressed, - or has already been released. + This property holds whether the touch point is currently pressed. */ -void QQuickTouchPoint::setValid(bool valid) +void QQuickTouchPoint::setPressed(bool pressed) { - if (_valid == valid) + if (_pressed == pressed) return; - _valid = valid; - emit validityChanged(); + _pressed = pressed; + emit pressedChanged(); } /*! @@ -417,25 +414,28 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) QList touchPoints = e->touchPoints(); int numTouchPoints = touchPoints.count(); //always remove released touches, and make sure we handle all releases before adds. - foreach (QTouchEvent::TouchPoint p, touchPoints) { + foreach (const QTouchEvent::TouchPoint &p, touchPoints) { Qt::TouchPointState touchPointState = p.state(); int id = p.id(); if (touchPointState & Qt::TouchPointReleased) { QQuickTouchPoint* dtp = static_cast(_touchPoints.value(id)); if (!dtp) continue; + updateTouchPoint(dtp, &p); + dtp->setPressed(false); _releasedTouchPoints.append(dtp); _touchPoints.remove(id); ended = true; } } if (numTouchPoints >= _minimumTouchPoints && numTouchPoints <= _maximumTouchPoints) { - foreach (QTouchEvent::TouchPoint p, touchPoints) { + foreach (const QTouchEvent::TouchPoint &p, touchPoints) { Qt::TouchPointState touchPointState = p.state(); int id = p.id(); if (touchPointState & Qt::TouchPointReleased) { //handled above } else if (!_touchPoints.contains(id)) { //could be pressed, moved, or stationary + // (we may have just obtained enough points to start tracking them -- in that case moved or stationary count as newly pressed) addTouchPoint(&p); started = true; } else if (touchPointState & Qt::TouchPointMoved) { @@ -491,7 +491,7 @@ void QQuickMultiPointTouchArea::clearTouchLists() if (!dtp->isQmlDefined()) delete dtp; else - dtp->setValid(false); + dtp->setInUse(false); } _releasedTouchPoints.clear(); _pressedTouchPoints.clear(); @@ -502,8 +502,8 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) { QQuickTouchPoint *dtp = 0; foreach (QQuickTouchPoint* tp, _touchPrototypes) { - if (!tp->isValid()) { - tp->setValid(true); + if (!tp->inUse()) { + tp->setInUse(true); dtp = tp; break; } @@ -513,10 +513,9 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) dtp = new QQuickTouchPoint(false); dtp->setPointId(p->id()); updateTouchPoint(dtp,p); + dtp->setPressed(true); _touchPoints.insert(p->id(),dtp); - //we may have just obtained enough points to start tracking them -- in that case moved or stationary count as newly pressed - if (p->state() & Qt::TouchPointPressed || p->state() & Qt::TouchPointMoved || p->state() & Qt::TouchPointStationary) - _pressedTouchPoints.append(dtp); + _pressedTouchPoints.append(dtp); } void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype) @@ -586,6 +585,8 @@ void QQuickMultiPointTouchArea::ungrab() setKeepMouseGrab(false); } setKeepTouchGrab(false); + foreach (QObject *obj, _touchPoints) + static_cast(obj)->setPressed(false); emit touchPointsCanceled(_touchPoints.values()); clearTouchLists(); foreach (QObject *obj, _touchPoints) { @@ -593,7 +594,7 @@ void QQuickMultiPointTouchArea::ungrab() if (!dtp->isQmlDefined()) delete dtp; else - dtp->setValid(false); + dtp->setInUse(false); } _touchPoints.clear(); } diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index aee18a3..dbce428 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -58,8 +58,8 @@ class QQuickMultiPointTouchArea; class Q_AUTOTEST_EXPORT QQuickTouchPoint : public QObject { Q_OBJECT - Q_PROPERTY(bool valid READ isValid NOTIFY validityChanged) Q_PROPERTY(int pointId READ pointId NOTIFY pointIdChanged) + Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged) Q_PROPERTY(qreal x READ x NOTIFY xChanged) Q_PROPERTY(qreal y READ y NOTIFY yChanged) Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged) @@ -78,7 +78,8 @@ public: _x(0.0), _y(0.0), _pressure(0.0), _qmlDefined(qmlDefined), - _valid(!qmlDefined), + _inUse(false), + _pressed(false), _previousX(0.0), _previousY(0.0), _sceneX(0.0), _sceneY(0.0) {} @@ -98,10 +99,13 @@ public: QRectF area() const { return _area; } void setArea(const QRectF &area); - bool isQmlDefined() { return _qmlDefined; } + bool isQmlDefined() const { return _qmlDefined; } - bool isValid() { return _valid; } - void setValid(bool valid); + bool inUse() const { return _inUse; } + void setInUse(bool inUse) { _inUse = inUse; } + + bool pressed() const { return _pressed; } + void setPressed(bool pressed); qreal startX() const { return _startX; } void setStartX(qreal startX); @@ -121,14 +125,13 @@ public: qreal sceneY() const { return _sceneY; } void setSceneY(qreal sceneY); - Q_SIGNALS: + void pressedChanged(); void pointIdChanged(); void xChanged(); void yChanged(); void pressureChanged(); void areaChanged(); - void validityChanged(); void startXChanged(); void startYChanged(); void previousXChanged(); @@ -144,7 +147,8 @@ private: qreal _pressure; QRectF _area; bool _qmlDefined; - bool _valid; + bool _inUse; //whether the point is currently in use (only valid when _qmlDefined == true) + bool _pressed; qreal _startX; qreal _startY; qreal _previousX; diff --git a/tests/auto/qtquick2/qquickmultipointtoucharea/data/basic.qml b/tests/auto/qtquick2/qquickmultipointtoucharea/data/basic.qml new file mode 100644 index 0000000..cd6ce81 --- /dev/null +++ b/tests/auto/qtquick2/qquickmultipointtoucharea/data/basic.qml @@ -0,0 +1,15 @@ +import QtQuick 2.0 + +MultiPointTouchArea { + width: 240 + height: 320 + + minimumTouchPoints: 1 + maximumTouchPoints: 4 + touchPoints: [ + TouchPoint { objectName: "point1" }, + TouchPoint { objectName: "point2" }, + TouchPoint { objectName: "point3" }, + TouchPoint { objectName: "point4" } + ] +} diff --git a/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 59a913e..44d2776 100644 --- a/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -62,6 +62,8 @@ private slots: void properties(); void signalTest(); + void release(); + void reuse(); void nonOverlapping(); void nested(); void inFlickable(); @@ -151,6 +153,104 @@ void tst_QQuickMultiPointTouchArea::signalTest() delete canvas; } +void tst_QQuickMultiPointTouchArea::release() +{ + QQuickView *canvas = createAndShowView("basic.qml"); + QVERIFY(canvas->rootObject() != 0); + + QQuickTouchPoint *point1 = canvas->rootObject()->findChild("point1"); + + QCOMPARE(point1->pressed(), false); + + QPoint p1(20,100); + + QTest::QTouchEventSequence sequence = QTest::touchEvent(canvas, device); + + sequence.press(0, p1).commit(); + + QCOMPARE(point1->pressed(), true); + + p1 += QPoint(0,10); + + sequence.move(0, p1).commit(); + + QCOMPARE(point1->pressed(), true); + QCOMPARE(point1->x(), qreal(20)); QCOMPARE(point1->y(), qreal(110)); + + p1 += QPoint(4,10); + + sequence.release(0, p1).commit(); + + //test that a release without a prior move to the release position successfully updates the point's position + QCOMPARE(point1->pressed(), false); + QCOMPARE(point1->x(), qreal(24)); QCOMPARE(point1->y(), qreal(120)); + + delete canvas; +} + +void tst_QQuickMultiPointTouchArea::reuse() +{ + QQuickView *canvas = createAndShowView("basic.qml"); + QVERIFY(canvas->rootObject() != 0); + + QQuickTouchPoint *point1 = canvas->rootObject()->findChild("point1"); + QQuickTouchPoint *point2 = canvas->rootObject()->findChild("point2"); + QQuickTouchPoint *point3 = canvas->rootObject()->findChild("point3"); + + QCOMPARE(point1->pressed(), false); + QCOMPARE(point2->pressed(), false); + + QPoint p1(20,100); + QPoint p2(40,100); + QPoint p3(60,100); + QPoint p4(80,100); + + QTest::QTouchEventSequence sequence = QTest::touchEvent(canvas, device); + + sequence.press(0, p1).press(1, p2).commit(); + + QCOMPARE(point1->pressed(), true); + QCOMPARE(point2->pressed(), true); + QCOMPARE(point3->pressed(), false); + + sequence.release(0, p1).stationary(1).press(2, p3).commit(); + + //we shouldn't reuse point 1 yet + QCOMPARE(point1->pressed(), false); + QCOMPARE(point2->pressed(), true); + QCOMPARE(point3->pressed(), true); + + //back to base state (no touches) + sequence.release(1, p2).release(2, p3).commit(); + + QCOMPARE(point1->pressed(), false); + QCOMPARE(point2->pressed(), false); + QCOMPARE(point3->pressed(), false); + + sequence.press(0, p1).press(1, p2).commit(); + + QCOMPARE(point1->pressed(), true); + QCOMPARE(point2->pressed(), true); + QCOMPARE(point3->pressed(), false); + + sequence.release(0, p1).stationary(1).commit(); + + QCOMPARE(point1->pressed(), false); + QCOMPARE(point2->pressed(), true); + QCOMPARE(point3->pressed(), false); + + sequence.press(4, p4).stationary(1).commit(); + + //the new touch point should reuse point 1 + QCOMPARE(point1->pressed(), true); + QCOMPARE(point2->pressed(), true); + QCOMPARE(point3->pressed(), false); + + QCOMPARE(point1->x(), qreal(80)); QCOMPARE(point1->y(), qreal(100)); + + delete canvas; +} + void tst_QQuickMultiPointTouchArea::nonOverlapping() { QQuickView *canvas = createAndShowView("nonOverlapping.qml"); @@ -162,11 +262,11 @@ void tst_QQuickMultiPointTouchArea::nonOverlapping() QQuickTouchPoint *point22 = canvas->rootObject()->findChild("point22"); QQuickTouchPoint *point23 = canvas->rootObject()->findChild("point23"); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); QPoint p1(20,100); QPoint p2(40,100); @@ -178,19 +278,19 @@ void tst_QQuickMultiPointTouchArea::nonOverlapping() sequence.press(0, p1).commit(); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); sequence.stationary(0).press(1, p2).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(100)); QCOMPARE(point12->x(), qreal(40)); QCOMPARE(point12->y(), qreal(100)); @@ -199,30 +299,30 @@ void tst_QQuickMultiPointTouchArea::nonOverlapping() p2 += QPoint(5,0); sequence.move(0, p1).move(1, p2).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110)); QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100)); sequence.stationary(0).stationary(1).press(2, p3).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); sequence.stationary(0).stationary(1).stationary(2).press(3, p4).press(4, p5).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110)); QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100)); @@ -237,11 +337,11 @@ void tst_QQuickMultiPointTouchArea::nonOverlapping() p5 += QPoint(-7,10); sequence.move(0, p1).move(1, p2).move(2, p3).move(3, p4).move(4, p5).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); QCOMPARE(point11->x(), qreal(24)); QCOMPARE(point11->y(), qreal(120)); QCOMPARE(point12->x(), qreal(62)); QCOMPARE(point12->y(), qreal(117)); @@ -251,12 +351,11 @@ void tst_QQuickMultiPointTouchArea::nonOverlapping() sequence.release(0, p1).release(1, p2).release(2, p3).release(3, p4).release(4, p5).commit(); - //points remain valid immediately after release - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); delete canvas; } @@ -272,11 +371,11 @@ void tst_QQuickMultiPointTouchArea::nested() QQuickTouchPoint *point22 = canvas->rootObject()->findChild("point22"); QQuickTouchPoint *point23 = canvas->rootObject()->findChild("point23"); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); QPoint p1(20,100); QPoint p2(40,100); @@ -286,19 +385,19 @@ void tst_QQuickMultiPointTouchArea::nested() sequence.press(0, p1).commit(); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); sequence.stationary(0).press(1, p2).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(100)); QCOMPARE(point12->x(), qreal(40)); QCOMPARE(point12->y(), qreal(100)); @@ -307,22 +406,22 @@ void tst_QQuickMultiPointTouchArea::nested() p2 += QPoint(5,0); sequence.move(0, p1).move(1, p2).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110)); QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100)); sequence.stationary(0).stationary(1).press(2, p3).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); //point11 should be same as point21, point12 same as point22 QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110)); @@ -333,11 +432,11 @@ void tst_QQuickMultiPointTouchArea::nested() sequence.stationary(0).stationary(1).stationary(2).press(3, QPoint(80,180)).press(4, QPoint(100,180)).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); //new touch points should be ignored (have no impact on our existing touch points) QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110)); @@ -353,11 +452,11 @@ void tst_QQuickMultiPointTouchArea::nested() p3 += QPoint(3,0); sequence.move(0, p1).move(1, p2).move(2, p3).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); QCOMPARE(point21->x(), qreal(24)); QCOMPARE(point21->y(), qreal(120)); QCOMPARE(point22->x(), qreal(62)); QCOMPARE(point22->y(), qreal(117)); @@ -370,11 +469,11 @@ void tst_QQuickMultiPointTouchArea::nested() p3 += QPoint(3,0); sequence.move(0, p1).move(1, p2).move(2, p3).commit(); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); //first two remain the same (touches now grabbed by inner touch area) QCOMPARE(point11->x(), qreal(24)); QCOMPARE(point11->y(), qreal(120)); @@ -387,11 +486,11 @@ void tst_QQuickMultiPointTouchArea::nested() sequence.press(0, p1).commit(); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); - QCOMPARE(point21->isValid(), false); - QCOMPARE(point22->isValid(), false); - QCOMPARE(point23->isValid(), false); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); + QCOMPARE(point21->pressed(), false); + QCOMPARE(point22->pressed(), false); + QCOMPARE(point23->pressed(), false); sequence.release(0, p1).commit(); @@ -400,22 +499,22 @@ void tst_QQuickMultiPointTouchArea::nested() sequence.press(0, p1).press(1, p2).press(2, p3).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); p1 -= QPoint(4,10); p2 -= QPoint(17,17); p3 -= QPoint(3,0); sequence.move(0, p1).move(1, p2).move(2, p3).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); QCOMPARE(point21->x(), qreal(24)); QCOMPARE(point21->y(), qreal(120)); QCOMPARE(point22->x(), qreal(62)); QCOMPARE(point22->y(), qreal(117)); @@ -428,11 +527,11 @@ void tst_QQuickMultiPointTouchArea::nested() p3 -= QPoint(3,0); sequence.move(0, p1).move(1, p2).move(2, p3).commit(); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); - QCOMPARE(point21->isValid(), true); - QCOMPARE(point22->isValid(), true); - QCOMPARE(point23->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); + QCOMPARE(point21->pressed(), true); + QCOMPARE(point22->pressed(), true); + QCOMPARE(point23->pressed(), true); //all change (touches not grabbed by inner touch area) QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110)); @@ -457,8 +556,8 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QQuickTouchPoint *point11 = canvas->rootObject()->findChild("point1"); QQuickTouchPoint *point12 = canvas->rootObject()->findChild("point2"); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); QPoint p1(20,100); QPoint p2(40,100); @@ -484,8 +583,8 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QTest::mouseMove(canvas, p1); QVERIFY(flickable->contentY() < 0); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); QTest::touchEvent(canvas, device).release(0, p1); QTest::mouseRelease(canvas,Qt::LeftButton, 0, p1); @@ -498,8 +597,8 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QTest::touchEvent(canvas, device).press(0, p1).press(1, p2); QTest::mousePress(canvas, Qt::LeftButton, 0, p1); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); p1 += QPoint(0,15); p2 += QPoint(0,15); QTest::touchEvent(canvas, device).move(0, p1).move(1, p2); @@ -518,8 +617,8 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QTest::mouseMove(canvas, p1); QVERIFY(flickable->contentY() < 0); - QCOMPARE(point11->isValid(), false); - QCOMPARE(point12->isValid(), false); + QCOMPARE(point11->pressed(), false); + QCOMPARE(point12->pressed(), false); QTest::touchEvent(canvas, device).release(0, p1).release(1, p2); QTest::mouseRelease(canvas,Qt::LeftButton, 0, p1); @@ -533,8 +632,8 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QTest::touchEvent(canvas, device).press(0, p1).press(1, p2); QTest::mousePress(canvas, Qt::LeftButton, 0, p1); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); p1 += QPoint(15,0); p2 += QPoint(15,0); QTest::touchEvent(canvas, device).move(0, p1).move(1, p2); @@ -569,8 +668,8 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QTest::mouseMove(canvas, p1); QVERIFY(flickable->contentY() == 0); - QCOMPARE(point11->isValid(), true); - QCOMPARE(point12->isValid(), true); + QCOMPARE(point11->pressed(), true); + QCOMPARE(point12->pressed(), true); QTest::touchEvent(canvas, device).release(0, p1).release(1, p2); QTest::mouseRelease(canvas,Qt::LeftButton, 0, p1); -- 2.7.4