summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-10-28 23:03:06 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-10-28 23:03:06 (GMT)
commit6c548e21f48b07d55187952ff21cbbc23fdd3927 (patch)
treedb284dc4f43da30a80f56fe54adad1e5c891e108 /src/declarative
parent6849c2f7f7ed0d024b8d8fd506fe59405c636082 (diff)
downloadQt-6c548e21f48b07d55187952ff21cbbc23fdd3927.zip
Qt-6c548e21f48b07d55187952ff21cbbc23fdd3927.tar.gz
Qt-6c548e21f48b07d55187952ff21cbbc23fdd3927.tar.bz2
Update viewport size when items are added/removed/resized.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfxlistview.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 15680e1..f9ae0c0 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -343,6 +343,15 @@ public:
return true;
}
+ void updateViewport() {
+ Q_Q(QFxListView);
+ if (orient == QFxListView::Vertical)
+ q->setViewportHeight(endPosition() - startPosition());
+ else
+ q->setViewportWidth(endPosition() - startPosition());
+ }
+
+
// for debugging only
void checkVisible() const {
int skip = 0;
@@ -553,10 +562,7 @@ void QFxListViewPrivate::refill(qreal from, qreal to)
updateAverage();
if (!sectionExpression.isEmpty())
updateCurrentSection();
- if (orient == QFxListView::Vertical)
- q->setViewportHeight(endPosition() - startPosition());
- else
- q->setViewportWidth(endPosition() - startPosition());
+ updateViewport();
}
}
@@ -581,6 +587,7 @@ void QFxListViewPrivate::layout()
updateHighlight();
fixupPosition();
updateUnrequestedPositions();
+ updateViewport();
}
void QFxListViewPrivate::updateUnrequestedIndexes()
@@ -1804,6 +1811,7 @@ void QFxListView::itemsInserted(int modelIndex, int count)
for (int j = 0; j < added.count(); ++j)
added.at(j)->attached->emitAdd();
d->updateUnrequestedPositions();
+ d->updateViewport();
emit countChanged();
}