diff --git a/autotests/iconitemtest.cpp b/autotests/iconitemtest.cpp index b7c973750..3bd114c10 100644 --- a/autotests/iconitemtest.cpp +++ b/autotests/iconitemtest.cpp @@ -240,8 +240,6 @@ void IconItemTest::animation() void IconItemTest::animationAfterHide() { - QEXPECT_FAIL("", "Needs 'no animation after hide' patch", Abort); - QQuickItem *item1 = createIconItem(); QQuickItem *item2 = createIconItem(); item1->setProperty("source", "user-away"); diff --git a/src/declarativeimports/core/iconitem.cpp b/src/declarativeimports/core/iconitem.cpp index 0d6fd1486..5798234d0 100644 --- a/src/declarativeimports/core/iconitem.cpp +++ b/src/declarativeimports/core/iconitem.cpp @@ -441,6 +441,16 @@ void IconItem::loadPixmap() update(); } +void IconItem::itemChange(ItemChange change, const ItemChangeData &value) +{ + if (change == ItemVisibleHasChanged && value.boolValue) { + // Clear pixmap to disable animation + m_iconPixmap = QPixmap(); + } + + QQuickItem::itemChange(change, value); +} + void IconItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { diff --git a/src/declarativeimports/core/iconitem.h b/src/declarativeimports/core/iconitem.h index 96133549f..558994a7f 100644 --- a/src/declarativeimports/core/iconitem.h +++ b/src/declarativeimports/core/iconitem.h @@ -129,6 +129,7 @@ public: void updatePolish() Q_DECL_OVERRIDE; QSGNode* updatePaintNode(QSGNode * oldNode, UpdatePaintNodeData * updatePaintNodeData) Q_DECL_OVERRIDE; + void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE; void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;