From cbd5c58e017757126b3c4bcafde7416444f6b8c0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 4 Dec 2009 11:11:24 +1000 Subject: Fix overshoot correction in ListView with variable height items. --- .../graphicsitems/qmlgraphicslistview.cpp | 39 ++++++++++------------ 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index 7a4e02c..d046a9b 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -495,10 +495,8 @@ void QmlGraphicsListViewPrivate::init() QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(refill())); QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped())); q->setFlickDirection(QmlGraphicsFlickable::VerticalFlick); - if (itemResizedIdx == -1) { + if (itemResizedIdx == -1) itemResizedIdx = QmlGraphicsListView::staticMetaObject.indexOfSlot("itemResized()"); - qDebug() << "ri" << itemResizedIdx; - } } void QmlGraphicsListViewPrivate::clear() @@ -1912,26 +1910,23 @@ void QmlGraphicsListView::viewportMoved() } } - if ((d->haveHighlightRange && d->highlightRange == QmlGraphicsListView::StrictlyEnforceRange) - || d->snapMode == QmlGraphicsListView::SnapToItem) { - if (d->flicked && d->correctFlick) { - // Near an end and it seems that the extent has changed? - // Recalculate the flick so that we don't end up in an odd position. - if (d->velocityY > 0) { - if (d->flickTargetY - d->_moveY.value() < height()/2 && minYExtent() != d->flickTargetY) - d->flickY(-d->verticalVelocity.value()); - } else if (d->velocityY < 0) { - if (d->_moveY.value() - d->flickTargetY < height()/2 && maxYExtent() != d->flickTargetY) - d->flickY(-d->verticalVelocity.value()); - } + if (d->flicked && d->correctFlick) { + // Near an end and it seems that the extent has changed? + // Recalculate the flick so that we don't end up in an odd position. + if (d->velocityY > 0) { + if (d->flickTargetY - d->_moveY.value() < height()/2 && minYExtent() != d->flickTargetY) + d->flickY(-d->verticalVelocity.value()); + } else if (d->velocityY < 0) { + if (d->_moveY.value() - d->flickTargetY < height()/2 && maxYExtent() != d->flickTargetY) + d->flickY(-d->verticalVelocity.value()); + } - if (d->velocityX > 0) { - if (d->flickTargetX - d->_moveX.value() < height()/2 && minXExtent() != d->flickTargetX) - d->flickX(-d->verticalVelocity.value()); - } else if (d->velocityX < 0) { - if (d->_moveX.value() - d->flickTargetX < height()/2 && maxXExtent() != d->flickTargetX) - d->flickX(-d->verticalVelocity.value()); - } + if (d->velocityX > 0) { + if (d->flickTargetX - d->_moveX.value() < height()/2 && minXExtent() != d->flickTargetX) + d->flickX(-d->verticalVelocity.value()); + } else if (d->velocityX < 0) { + if (d->_moveX.value() - d->flickTargetX < height()/2 && maxXExtent() != d->flickTargetX) + d->flickX(-d->verticalVelocity.value()); } } } -- cgit v0.12 From 7f5160ca67a5b4a4a64fa78c678834c0a97b9ee2 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 4 Dec 2009 12:07:39 +1000 Subject: Revert 1dd1886390f56810f3fffbc66e823dca9132a89c - wasn't a leak. --- src/declarative/graphicsitems/qmlgraphicstext.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicstext.cpp b/src/declarative/graphicsitems/qmlgraphicstext.cpp index 854d503..ad12189 100644 --- a/src/declarative/graphicsitems/qmlgraphicstext.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstext.cpp @@ -121,8 +121,6 @@ QmlGraphicsText::~QmlGraphicsText() QmlGraphicsTextPrivate::~QmlGraphicsTextPrivate() { - delete control; - delete doc; } /*! -- cgit v0.12 From 5d3db0fbfa96964b9448705d9edd4c0cd9e65816 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 4 Dec 2009 12:45:03 +1000 Subject: Delete released items immediately. --- src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp index b973d6c..a6c40c5 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp @@ -761,8 +761,7 @@ QmlGraphicsVisualDataModel::ReleaseFlags QmlGraphicsVisualDataModel::release(Qml if (inPackage) emit destroyingPackage(qobject_cast(obj)); stat |= Destroyed; - obj->setParent(0); - obj->deleteLater(); + delete obj; } else if (!inPackage) { stat |= Referenced; } -- cgit v0.12