summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-08-16 01:17:56 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-08-16 01:17:56 (GMT)
commitf7c07892e927a6420bb64a7011312f0a4a5a1fc9 (patch)
tree54bf701b991453e9595f984594dae552dd9fb6e4
parentd904fe2273be5d39b54b987eef6b9cc0d1b85c4b (diff)
downloadQt-f7c07892e927a6420bb64a7011312f0a4a5a1fc9.zip
Qt-f7c07892e927a6420bb64a7011312f0a4a5a1fc9.tar.gz
Qt-f7c07892e927a6420bb64a7011312f0a4a5a1fc9.tar.bz2
emit countChanged where appropriate in Repeater
Task-number: QTBUG-12905 Reviewed-by: Bea Lam
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
index 68e7e9a..b4b6c02 100644
--- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
@@ -245,8 +245,8 @@ void QDeclarativeRepeater::setModel(const QVariant &model)
connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
*/
regenerate();
- emit countChanged();
}
+ emit countChanged();
}
/*!
@@ -377,6 +377,7 @@ void QDeclarativeRepeater::itemsInserted(int index, int count)
d->deletables.insert(modelIndex, item);
}
}
+ emit countChanged();
}
void QDeclarativeRepeater::itemsRemoved(int index, int count)
@@ -391,6 +392,7 @@ void QDeclarativeRepeater::itemsRemoved(int index, int count)
else
break;
}
+ emit countChanged();
}
void QDeclarativeRepeater::itemsMoved(int from, int to, int count)
@@ -420,6 +422,7 @@ void QDeclarativeRepeater::modelReset()
if (!isComponentComplete())
return;
regenerate();
+ emit countChanged();
}
QT_END_NAMESPACE
diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
index 623b3d7..360d90f 100644
--- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
+++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
@@ -309,11 +309,14 @@ void tst_QDeclarativeRepeater::dataModel()
QCOMPARE(container->childItems().count(), 4);
+ QSignalSpy repeaterSpy(repeater, SIGNAL(countChanged()));
testModel.addItem("four", "4");
QCOMPARE(container->childItems().count(), 5);
+ QCOMPARE(repeaterSpy.count(),1);
testModel.removeItem(2);
QCOMPARE(container->childItems().count(), 4);
+ QCOMPARE(repeaterSpy.count(),2);
// Check that model changes are propagated
QDeclarativeText *text = findItem<QDeclarativeText>(canvas->rootObject(), "myName", 1);