diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-04-30 01:30:39 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-04-30 01:30:39 (GMT) |
commit | 62d4b6c36a916291cab91344c5a9fda4c4b2b490 (patch) | |
tree | 0b846c9d0b55ea3fa97b015bc395d663faad9006 | |
parent | 562c1dabcf020537a932d59efe0afa4a25e33fa9 (diff) | |
download | Qt-62d4b6c36a916291cab91344c5a9fda4c4b2b490.zip Qt-62d4b6c36a916291cab91344c5a9fda4c4b2b490.tar.gz Qt-62d4b6c36a916291cab91344c5a9fda4c4b2b490.tar.bz2 |
buffer new items on initialization.
We weren't honoring buffer initially, only after a flick. Its better
to buffer immediately, since it is often used to eliminate the cost
of item creation in small lists.
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 5 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativelistview.cpp | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index febd34a..777d6db 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -108,7 +108,7 @@ public: , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) , highlightMoveDuration(150) - , bufferMode(NoBuffer), snapMode(QDeclarativeGridView::NoSnap) + , bufferMode(BufferBefore | BufferAfter), snapMode(QDeclarativeGridView::NoSnap) , ownModel(false), wrap(false), autoHighlight(true) , fixCurrentVisibility(false), lazyRelease(false), layoutScheduled(false) , deferredRelease(false), haveHighlightRange(false) {} @@ -331,7 +331,7 @@ public: QSmoothedAnimation *highlightYAnimator; int highlightMoveDuration; enum BufferMode { NoBuffer = 0x00, BufferBefore = 0x01, BufferAfter = 0x02 }; - BufferMode bufferMode; + int bufferMode; QDeclarativeGridView::SnapMode snapMode; bool ownModel : 1; @@ -1029,6 +1029,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) dataModel->setModel(model); } if (d->model) { + d->bufferMode = QDeclarativeGridViewPrivate::BufferBefore | QDeclarativeGridViewPrivate::BufferAfter; if (isComponentComplete()) { refill(); if (d->currentIndex >= d->model->count() || d->currentIndex < 0) { diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 3f150dc..d50e734 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -161,9 +161,9 @@ public: , highlightResizeSpeed(400), highlightResizeDuration(-1), highlightRange(QDeclarativeListView::NoHighlightRange) , snapMode(QDeclarativeListView::NoSnap), overshootDist(0.0) , footerComponent(0), footer(0), headerComponent(0), header(0) - , bufferMode(NoBuffer) + , bufferMode(BufferBefore | BufferAfter) , ownModel(false), wrap(false), autoHighlight(true), haveHighlightRange(false) - , correctFlick(true), inFlickCorrection(false), lazyRelease(false) + , correctFlick(false), inFlickCorrection(false), lazyRelease(false) , deferredRelease(false), layoutScheduled(false), minExtentDirty(true), maxExtentDirty(true) {} @@ -1462,6 +1462,7 @@ void QDeclarativeListView::setModel(const QVariant &model) dataModel->setModel(model); } if (d->model) { + d->bufferMode = QDeclarativeListViewPrivate::BufferBefore | QDeclarativeListViewPrivate::BufferAfter; if (isComponentComplete()) { refill(); if (d->currentIndex >= d->model->count() || d->currentIndex < 0) { |