From 80c04413ba2c1a20a5d93d69df92ba908c26d81d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 5 May 2010 16:03:16 +1000 Subject: Document delegate life cycle. Task-number: QTBUG-10353 --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 3 +++ src/declarative/graphicsitems/qdeclarativelistview.cpp | 3 +++ src/declarative/graphicsitems/qdeclarativepathview.cpp | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index f55c483..4c72482 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -908,6 +908,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. + Delegates are instantiated as needed and may be destroyed at any time. + State should \e never be stored in a delegate. + \bold Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 589b8e2..3877fab 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1314,6 +1314,9 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. + Delegates are instantiated as needed and may be destroyed at any time. + State should \e never be stored in a delegate. + \bold Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 9ae6f9d..5c3a3c0 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -308,12 +308,16 @@ void QDeclarativePathViewPrivate::regenerate() The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in QML. - The items are laid out along a path defined by a \l Path and may be flicked to scroll. + The \l delegate is instantiated for each item on the \l path. + The items may be flicked to move them along the path. \snippet doc/src/snippets/declarative/pathview/pathview.qml 0 \image pathview.gif + Delegates are instantiated as needed and may be destroyed at any time. + State should \e never be stored in a delegate. + \bold Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped -- cgit v0.12