diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-07-28 20:11:52 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-29 02:47:11 +0200 |
commit | 98ebab25abc8f66629598cb9ebd4fe942bc0c57f (patch) | |
tree | 9e15b4df8fc9c15542188aab6762198d90b27edb /src/declarative/items | |
parent | 02552f26e4e274c50d3466cce86d9038b9f687c7 (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/items')
-rw-r--r-- | src/declarative/items/qsgpathview.cpp | 5 |
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(); } |