From 7c9a1d681c91c6f28a23a52a29ef6a08671ea49a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 31 Jul 2009 14:42:08 +1000 Subject: Some pathview focus fixes. --- src/declarative/fx/qfxpathview.cpp | 19 ++++++++++++++----- 1 file 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; -- cgit v0.12 From 3e74b943b05bdff967d6cbae108c1842f410f412 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 31 Jul 2009 15:18:00 +1000 Subject: Doc --- src/declarative/fx/qfxevents.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/declarative/fx/qfxevents.cpp b/src/declarative/fx/qfxevents.cpp index 94c2d2e..f3a3427 100644 --- a/src/declarative/fx/qfxevents.cpp +++ b/src/declarative/fx/qfxevents.cpp @@ -106,6 +106,17 @@ Item { */ /*! + \qmlproperty bool KeyEvent::accepted + + Setting \a accepted to true prevents the key event from being + propagated to the item's parent. + + Generally, if the item acts on the key event then it should be accepted + so that ancestor items do not also respond to the same event. +*/ + + +/*! \qmlclass MouseEvent QFxMouseEvent \brief The MouseEvent object provides information about a mouse event. -- cgit v0.12