Commit 0d1f29c6 authored by Michael Brasser's avatar Michael Brasser Committed by Qt by Nokia

Ensure visibility changes are communicated through itemChange.

Also added MouseArea test that depends on this functionality.

Change-Id: I1c303504ffd63d6b9dbdf95ab63e8426dc09c02d
Reviewed-by: default avatarAndrew den Exter <andrew.den-exter@nokia.com>
parent 64a5087d
......@@ -4009,11 +4009,7 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
for (int ii = 0; ii < childItems.count(); ++ii)
childVisibilityChanged |= QQuickItemPrivate::get(childItems.at(ii))->setEffectiveVisibleRecur(newEffectiveVisible);
for (int ii = 0; ii < changeListeners.count(); ++ii) {
const QQuickItemPrivate::ChangeListener &change = changeListeners.at(ii);
if (change.types & QQuickItemPrivate::Visibility)
change.listener->itemVisibilityChanged(q);
}
itemChange(QQuickItem::ItemVisibleHasChanged, effectiveVisible);
if (isAccessible)
QAccessible::updateAccessibility(QAccessibleEvent(effectiveVisible ? QAccessible::ObjectShow : QAccessible::ObjectHide, q, 0));
......
......@@ -168,7 +168,7 @@ public:
ItemChildAddedChange, // value.item
ItemChildRemovedChange, // value.item
ItemSceneChange, // value.canvas
ItemVisibleHasChanged, // value.realValue
ItemVisibleHasChanged, // value.boolValue
ItemParentHasChanged, // value.item
ItemOpacityHasChanged, // value.realValue
ItemActiveFocusHasChanged, // value.boolValue
......
import QtQuick 2.0
Rectangle {
width: 400; height: 400;
Rectangle {
width: 100; height: 100;
MouseArea {
id: mousetracker; objectName: "mousetracker"
anchors.fill: parent
visible: false
hoverEnabled: true
}
}
}
......@@ -71,6 +71,7 @@ private slots:
void clickThrough();
void hoverPosition();
void hoverPropagation();
void hoverVisible();
private:
QQuickView *createView();
......@@ -771,6 +772,35 @@ void tst_QQuickMouseArea::hoverPropagation()
delete canvas;
}
void tst_QQuickMouseArea::hoverVisible()
{
QQuickView *canvas = createView();
canvas->setSource(testFileUrl("hoverVisible.qml"));
QQuickItem *root = canvas->rootObject();
QVERIFY(root != 0);
QQuickMouseArea *mouseTracker = canvas->rootObject()->findChild<QQuickMouseArea*>("mousetracker");
QVERIFY(mouseTracker != 0);
QSignalSpy enteredSpy(mouseTracker, SIGNAL(entered()));
QTest::mouseMove(canvas,QPoint(10,32));
QCOMPARE(mouseTracker->hovered(), false);
QCOMPARE(enteredSpy.count(), 0);
mouseTracker->setVisible(true);
QCOMPARE(mouseTracker->hovered(), true);
QCOMPARE(enteredSpy.count(), 1);
QEXPECT_FAIL("", "QTBUG-24282", Continue);
QCOMPARE(QPointF(mouseTracker->mouseX(), mouseTracker->mouseY()), QPointF(10,32));
delete canvas;
}
QTEST_MAIN(tst_QQuickMouseArea)
#include "tst_qquickmousearea.moc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment