Emit itemChanged when Loader fails to load a source.
authorAlan Alpert <alan.alpert@nokia.com>
Tue, 12 Jun 2012 01:47:13 +0000 (11:47 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 12 Jun 2012 13:40:13 +0000 (15:40 +0200)
As per the source comment, it is not actually tracked whether item was
null before. This is consistent with the behaviour in loadFromSource,
where setting a source to null always emits item changed.

This is reasonable behaviour, because it only occurs in unexpected error
states where the program logic likely expects a changed signal anyways.

Change-Id: I160ab04dc1b5c578ee508f4adbca65e8da5b16be
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
src/quick/items/qquickloader.cpp
tests/auto/quick/qquickloader/tst_qquickloader.cpp

index 04e248e..a5740ac 100644 (file)
@@ -675,6 +675,7 @@ void QQuickLoaderPrivate::_q_sourceLoaded()
             emit q->sourceComponentChanged();
         emit q->statusChanged();
         emit q->progressChanged();
+        emit q->itemChanged(); //Like clearing source, emit itemChanged even if previous item was also null
         disposeInitialPropertyValues(); // cleanup
         return;
     }
index e7cef8c..dfe02c6 100644 (file)
@@ -187,7 +187,7 @@ void tst_QQuickLoader::sourceOrComponent()
     QCOMPARE(loader->property("onStatusChangedCount").toInt(), 1);
     QCOMPARE(loader->property("onProgressChangedCount").toInt(), 1);
 
-    QCOMPARE(loader->property("onItemChangedCount").toInt(), error ? 0 : 1);
+    QCOMPARE(loader->property("onItemChangedCount").toInt(), 1);
     QCOMPARE(loader->property("onLoadedCount").toInt(), error ? 0 : 1);
 
     delete loader;