aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-07-28 20:11:52 +1000
committerQt by Nokia <qt-info@nokia.com>2011-07-29 02:47:11 +0200
commit98ebab25abc8f66629598cb9ebd4fe942bc0c57f (patch)
tree9e15b4df8fc9c15542188aab6762198d90b27edb /src/declarative
parent02552f26e4e274c50d3466cce86d9038b9f687c7 (diff)
Jump to same model index (if it exists) when the model changes
For PathView, ListView does this already. Task-number: QTBUG-19059 Change-Id: Id09087ad372e46661794b0cb15cb30fc88802c4b Reviewed-on: http://codereview.qt.nokia.com/2330 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/items/qsgpathview.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/declarative/items/qsgpathview.cpp b/src/declarative/items/qsgpathview.cpp
index 7dd58c55f3..e10575cf7b 100644
--- a/src/declarative/items/qsgpathview.cpp
+++ b/src/declarative/items/qsgpathview.cpp
@@ -418,7 +418,10 @@ void QSGPathView::setModel(const QVariant &model)
d->offset = d->model->count() + d->offset;
}
d->regenerate();
- d->fixOffset();
+ if (d->currentIndex < d->modelCount)
+ setOffset(qmlMod(d->modelCount - d->currentIndex, d->modelCount));
+ else
+ d->fixOffset();
emit countChanged();
emit modelChanged();
}