Fix insertion of one item in ListView.
Off-by-one meant that the item was not created by the ListView. Change-Id: If9658487a615e189c21c419e4d29e7e709e05cef Fixes: QTBUG-19675 Reviewed-on: http://codereview.qt.nokia.com/2251 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
This commit is contained in:
parent
aa99d4f5cb
commit
a8d3802938
|
@ -3287,7 +3287,7 @@ void QDeclarative1ListView::itemsInserted(int modelIndex, int count)
|
|||
}
|
||||
} else {
|
||||
int i = 0;
|
||||
int to = d->buffer+tempPos+d->size()-1;
|
||||
int to = d->buffer+tempPos+d->size();
|
||||
for (i = 0; i < count && pos <= to; ++i) {
|
||||
if (!addedVisible) {
|
||||
d->scheduleLayout();
|
||||
|
|
|
@ -620,6 +620,14 @@ void tst_QSGListView::inserted()
|
|||
|
||||
// QTRY_COMPARE(listview->contentItemHeight(), model.count() * 20.0);
|
||||
|
||||
// QTBUG-19675
|
||||
model.clear();
|
||||
model.insertItem(0, "Hello", "1234");
|
||||
QSGItem *item = findItem<QSGItem>(contentItem, "wrapper", 0);
|
||||
QVERIFY(item);
|
||||
QCOMPARE(item->y(), 0.);
|
||||
QVERIFY(listview->contentY() == 0);
|
||||
|
||||
delete canvas;
|
||||
delete testObject;
|
||||
}
|
||||
|
|
|
@ -557,6 +557,14 @@ void tst_QDeclarative1ListView::inserted()
|
|||
|
||||
// QTRY_COMPARE(listview->contentItemHeight(), model.count() * 20.0);
|
||||
|
||||
// QTBUG-19675
|
||||
model.clear();
|
||||
model.insertItem(0, "Hello", "1234");
|
||||
QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", 0);
|
||||
QVERIFY(item);
|
||||
QCOMPARE(item->y(), 0.);
|
||||
QVERIFY(listview->contentY() == 0);
|
||||
|
||||
delete canvas;
|
||||
delete testObject;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue