diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-05-05 04:38:55 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-05-05 04:38:55 (GMT) |
commit | ce9bc843443f2c61361afa75a62a7d39029557e6 (patch) | |
tree | a097566f26f14a1e0d2aa650cb803beb6ed1bddb /doc/src/declarative | |
parent | 02df0ce446a89298109e1c7d0ef1e790d41d442f (diff) | |
download | Qt-ce9bc843443f2c61361afa75a62a7d39029557e6.zip Qt-ce9bc843443f2c61361afa75a62a7d39029557e6.tar.gz Qt-ce9bc843443f2c61361afa75a62a7d39029557e6.tar.bz2 |
QList<QObject*> models now update their properties when they change.
Task-number: QTBUG-10348
Diffstat (limited to 'doc/src/declarative')
-rw-r--r-- | doc/src/declarative/qdeclarativemodels.qdoc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 91acb3c..9b706a1 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -283,7 +283,9 @@ QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); \endcode -The properties of the object may then be accessed in the delegate: +The QObject* is available as the \c modelData property. As a convenience, +the properties of the object are also made available directly in the +delegate's context: \code ListView { @@ -295,13 +297,18 @@ ListView { Rectangle { height: 25 width: 100 - color: model.color + color: model.modelData.color Text { text: name } } } } \endcode +Note the use of the fully qualified access to the \c color property. +The properties of the object are not replicated in the \c model +object, since they are easily available via the modelData +object. + Note: There is no way for the view to know that the contents of a QList have changed. If the QList is changed, it will be necessary to reset the model by calling QDeclarativeContext::setContextProperty() again. |