Skip to content

Commit

Permalink
Invisible items should not respond to touch events.
Browse files Browse the repository at this point in the history
Task-number: QTBUG-23327
Change-Id: I959c9ba40e4ce3972fc3fde2f1c7e73615e78e2e
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
  • Loading branch information
Michael Brasser authored and Qt by Nokia committed Dec 28, 2011
1 parent ed36194 commit 7810092
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/quick/items/qquickcanvas.cpp
Expand Up @@ -1111,7 +1111,7 @@ bool QQuickCanvasPrivate::deliverTouchPoints(QQuickItem *item, QTouchEvent *even
QList<QQuickItem *> children = itemPrivate->paintOrderChildItems();
for (int ii = children.count() - 1; ii >= 0; --ii) {
QQuickItem *child = children.at(ii);
if (!child->isEnabled())
if (!child->isEnabled() || !child->isVisible())
continue;
if (deliverTouchPoints(child, event, newPoints, acceptedNewPoints, updatedPoints))
return true;
Expand Down
Expand Up @@ -67,6 +67,7 @@ private slots:
void nonOverlapping();
void nested();
void inFlickable();
void invisible();

private:
QQuickView *createAndShowView(const QString &file);
Expand Down Expand Up @@ -678,6 +679,33 @@ void tst_QQuickMultiPointTouchArea::inFlickable()
delete canvas;
}

// QTBUG-23327
void tst_QQuickMultiPointTouchArea::invisible()
{
QQuickView *canvas = createAndShowView("signalTest.qml");
QVERIFY(canvas->rootObject() != 0);

QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(canvas->rootObject());
QVERIFY(area != 0);

area->setVisible(false);

QPoint p1(20,100);
QPoint p2(40,100);

QTest::QTouchEventSequence sequence = QTest::touchEvent(canvas, device);

sequence.press(0, p1).press(1, p2).commit();

QCOMPARE(area->property("touchPointPressCount").toInt(), 0);
QCOMPARE(area->property("touchPointUpdateCount").toInt(), 0);
QCOMPARE(area->property("touchPointReleaseCount").toInt(), 0);
QCOMPARE(area->property("touchCount").toInt(), 0);

delete canvas;
}


QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file)
{
QQuickView *canvas = new QQuickView(0);
Expand Down

0 comments on commit 7810092

Please sign in to comment.