diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-07-31 04:42:08 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-07-31 04:42:08 (GMT) |
commit | 7c9a1d681c91c6f28a23a52a29ef6a08671ea49a (patch) | |
tree | 8f7e51e3447b6200b24762f58c5c118e8d0cf21b /src/declarative/fx/qfxpathview.cpp | |
parent | 8358e5b93efcb119cc7dd036c8f5f4ae960f702e (diff) | |
download | Qt-7c9a1d681c91c6f28a23a52a29ef6a08671ea49a.zip Qt-7c9a1d681c91c6f28a23a52a29ef6a08671ea49a.tar.gz Qt-7c9a1d681c91c6f28a23a52a29ef6a08671ea49a.tar.bz2 |
Some pathview focus fixes.
Diffstat (limited to 'src/declarative/fx/qfxpathview.cpp')
-rw-r--r-- | src/declarative/fx/qfxpathview.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index 98121e6..092c258 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -575,13 +575,16 @@ void QFxPathViewPrivate::regenerate() int numItems = pathItems >= 0 ? pathItems : model->count(); for (int i=0; i < numItems && i < model->count(); ++i){ - QFxItem *item = getItem((i + firstIndex) % model->count()); + int index = (i + firstIndex) % model->count(); + QFxItem *item = getItem(index); if (!item) { qWarning() << "PathView: Cannot create item, index" << (i + firstIndex) % model->count(); return; } items.append(item); item->setZValue(i); + if (currentIndex == index) + item->setFocus(true); } q->refill(); } @@ -638,8 +641,11 @@ void QFxPathView::refill() d->firstIndex++; d->firstIndex %= d->model->count(); int index = (d->firstIndex + d->items.count())%d->model->count(); - d->items << d->getItem(index); - d->items.last()->setZValue(wrapIndex); + QFxItem *item = d->getItem(index); + item->setZValue(wrapIndex); + if (d->currentIndex == index) + item->setFocus(true); + d->items << item; d->pathOffset++; d->pathOffset=d->pathOffset % d->items.count(); } @@ -651,8 +657,11 @@ void QFxPathView::refill() d->firstIndex--; if (d->firstIndex < 0) d->firstIndex = d->model->count() - 1; - d->items.prepend(d->getItem(d->firstIndex)); - d->items.first()->setZValue(d->firstIndex); + QFxItem *item = d->getItem(d->firstIndex); + item->setZValue(d->firstIndex); + if (d->currentIndex == d->firstIndex) + item->setFocus(true); + d->items.prepend(item); d->pathOffset--; if (d->pathOffset < 0) d->pathOffset = d->items.count() - 1; |