From: Alan Alpert Date: Tue, 12 Jun 2012 01:47:13 +0000 (+1000) Subject: Emit itemChanged when Loader fails to load a source. X-Git-Tag: 071012131707~169 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e883fa03efad4384f030cec5f13c22346356e3bf;p=profile%2Fivi%2Fqtdeclarative.git Emit itemChanged when Loader fails to load a source. 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 --- diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 04e248e..a5740ac 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -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; } diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index e7cef8c..dfe02c6 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -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;