summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-02-10 11:17:03 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-02-10 11:17:03 (GMT)
commit1c1d31d702ee22b2cf501a4472b7068ad160df68 (patch)
treeada27056563ed7d7b1c1886e69962075ddfc397d /src
parentae0195f08b37a7250fa4148f6fe8ec9a17421148 (diff)
parent8b8df42a21f3a288c8103aabf537db3335f00d5e (diff)
downloadQt-1c1d31d702ee22b2cf501a4472b7068ad160df68.zip
Qt-1c1d31d702ee22b2cf501a4472b7068ad160df68.tar.gz
Qt-1c1d31d702ee22b2cf501a4472b7068ad160df68.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgridview.cpp11
-rw-r--r--src/declarative/graphicsitems/qmlgraphicslistview.cpp14
2 files changed, 16 insertions, 9 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
index afc2e15..83911c0 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
@@ -158,7 +158,8 @@ public:
, moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0)
, bufferMode(NoBuffer)
, ownModel(false), wrap(false), autoHighlight(true)
- , fixCurrentVisibility(false), lazyRelease(false), layoutScheduled(false) {}
+ , fixCurrentVisibility(false), lazyRelease(false), layoutScheduled(false)
+ , deferredRelease(false) {}
void init();
void clear();
@@ -337,6 +338,7 @@ public:
bool fixCurrentVisibility : 1;
bool lazyRelease : 1;
bool layoutScheduled : 1;
+ bool deferredRelease : 1;
};
void QmlGraphicsGridViewPrivate::init()
@@ -484,7 +486,7 @@ void QmlGraphicsGridViewPrivate::refill(qreal from, qreal to, bool doBuffer)
break;
}
- if (!lazyRelease || !changed) { // avoid destroying items in the same frame that we create
+ if (!lazyRelease || !changed || deferredRelease) { // avoid destroying items in the same frame that we create
while (visibleItems.count() > 1
&& (item = visibleItems.first())
&& item->endRowPos() < bufferFrom - rowSize()*(item->colPos()/colSize()+1)/(columns+1)) {
@@ -507,6 +509,9 @@ void QmlGraphicsGridViewPrivate::refill(qreal from, qreal to, bool doBuffer)
releaseItem(item);
changed = true;
}
+ deferredRelease = false;
+ } else {
+ deferredRelease = true;
}
if (changed) {
if (flow == QmlGraphicsGridView::LeftToRight)
@@ -1416,7 +1421,7 @@ void QmlGraphicsGridView::componentComplete()
void QmlGraphicsGridView::trackedPositionChanged()
{
Q_D(QmlGraphicsGridView);
- if (!d->trackedItem)
+ if (!d->trackedItem || !d->currentItem)
return;
if (!isFlicking() && !d->moving && d->moveReason == QmlGraphicsGridViewPrivate::SetIndex) {
const qreal viewPos = d->position();
diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp
index 15064cd..d0b3739 100644
--- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp
@@ -223,7 +223,7 @@ public:
, bufferMode(NoBuffer)
, ownModel(false), wrap(false), autoHighlight(true), haveHighlightRange(false)
, correctFlick(true), inFlickCorrection(false), lazyRelease(false)
- , minExtentDirty(true), maxExtentDirty(true)
+ , deferredRelease(false), minExtentDirty(true), maxExtentDirty(true)
{}
void init();
@@ -448,11 +448,9 @@ public:
void updateViewport() {
Q_Q(QmlGraphicsListView);
if (orient == QmlGraphicsListView::Vertical) {
- qreal vpHeight = -q->maxYExtent() + q->minYExtent() + q->height();
- q->setViewportHeight(vpHeight);
+ q->setViewportHeight(endPosition() - startPosition() + 1);
} else {
- qreal vpWidth = -q->maxXExtent() + q->minXExtent() + q->width();
- q->setViewportWidth(qMin(vpWidth, q->width()));
+ q->setViewportWidth(endPosition() - startPosition() + 1);
}
}
@@ -544,6 +542,7 @@ public:
bool correctFlick : 1;
bool inFlickCorrection : 1;
bool lazyRelease : 1;
+ bool deferredRelease : 1;
mutable bool minExtentDirty : 1;
mutable bool maxExtentDirty : 1;
};
@@ -701,7 +700,7 @@ void QmlGraphicsListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
break;
}
- if (!lazyRelease || !changed) { // avoid destroying items in the same frame that we create
+ if (!lazyRelease || !changed || deferredRelease) { // avoid destroying items in the same frame that we create
while (visibleItems.count() > 1 && (item = visibleItems.first()) && item->endPosition() < bufferFrom) {
if (item->attached->delayRemove())
break;
@@ -720,6 +719,9 @@ void QmlGraphicsListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
releaseItem(item);
changed = true;
}
+ deferredRelease = false;
+ } else {
+ deferredRelease = true;
}
if (changed) {
minExtentDirty = true;