diff options
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepathview.cpp | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 3ae8788..31943b2 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -1331,6 +1331,8 @@ void QDeclarativePathView::refill() if (idx >= d->modelCount) idx = 0; } + if (!d->items.count()) + d->firstIndex = -1; if (d->modelCount) { // add items to beginning and end diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 3a2a577..a2a5363 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -351,6 +351,10 @@ void tst_QDeclarativePathView::dataModel() model.addItem("yellow", "7"); model.addItem("thistle", "8"); model.addItem("cyan", "9"); + model.addItem("peachpuff", "10"); + model.addItem("powderblue", "11"); + model.addItem("gold", "12"); + model.addItem("sandybrown", "13"); ctxt->setContextProperty("testData", &model); @@ -371,7 +375,7 @@ void tst_QDeclarativePathView::dataModel() model.insertItem(4, "orange", "10"); QTest::qWait(100); - QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 10); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 14); QVERIFY(pathview->currentIndex() == 0); @@ -420,6 +424,11 @@ void tst_QDeclarativePathView::dataModel() QVERIFY(item->property("onPath").toBool()); } + // QTBUG-14199 + pathview->setOffset(7); + pathview->setOffset(0); + QCOMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5); + delete canvas; } |