From d27e7484c8fcb08e0c533b9a8bf5af8d527b1de3 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 29 Jul 2010 15:12:17 +1000 Subject: Document elements that are focus scopes. Task-number: QTBUG-12404 --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 8 +++++--- src/declarative/graphicsitems/qdeclarativelistview.cpp | 10 ++++++---- src/declarative/graphicsitems/qdeclarativeloader.cpp | 3 +++ src/declarative/graphicsitems/qdeclarativepathview.cpp | 5 ++++- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 89b3958..f02ef6b 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1085,13 +1085,15 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \c portrait data directly. An improved grid view is shown below. The delegate is visually improved and is moved - into a separate \c contactDelegate component. Also, the currently selected item is highlighted - with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true - to enable keyboard navigation for the grid view. + into a separate \c contactDelegate component. \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs advanced \image gridview-highlight.png + The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property, + and \c focus is set to \c true to enable keyboard navigation for the grid view. + The grid view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details). + Delegates are instantiated as needed and may be destroyed at any time. State should \e never be stored in a delegate. diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index b3e1dc0..b0a11b9 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1385,14 +1385,16 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m the delegate is able to access the model's \c name and \c number data directly. An improved list view is shown below. The delegate is visually improved and is moved - into a separate \c contactDelegate component. Also, the currently selected item is highlighted - with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true - to enable keyboard navigation for the list view. + into a separate \c contactDelegate component. \snippet doc/src/snippets/declarative/listview/listview.qml classdocs advanced \image listview-highlight.png - In a GridView, delegates are instantiated as needed and may be destroyed at any time. + The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property, + and \c focus is set to \c true to enable keyboard navigation for the list view. + The list view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details). + + Delegates are instantiated as needed and may be destroyed at any time. State should \e never be stored in a delegate. \note Views do not enable \e clip automatically. If the view diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index cc7f8e5..d28181e 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -159,6 +159,9 @@ void QDeclarativeLoaderPrivate::initResize() unloads "Page1.qml" and frees resources consumed by it. + Note that Loader is a focus scope. Its \c focus property must be set to \c true for any of its children + to get the \e {active focus} (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details). + \sa {dynamic-object-creation}{Dynamic Object Creation} */ diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index acf9827..3ad8fb38 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -314,7 +314,7 @@ void QDeclarativePathViewPrivate::regenerate() and XmlListModel, or custom model classes defined in C++ that inherit from QAbstractListModel. - A ListView has a \l model, which defines the data to be displayed, and + The view has a \l model, which defines the data to be displayed, and a \l delegate, which defines how the data should be displayed. The \l delegate is instantiated for each item on the \l path. The items may be flicked to move them along the path. @@ -333,6 +333,9 @@ void QDeclarativePathViewPrivate::regenerate() opacity of the items as they rotate. This additional code can be seen in the PathAttribute documentation.) + The \c focus can be set to \c true to enable keyboard navigation. + The path view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details). + Delegates are instantiated as needed and may be destroyed at any time. State should \e never be stored in a delegate. -- cgit v0.12