diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-22 04:56:49 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-22 05:53:27 (GMT) |
commit | 33eb76f050b45718d87926a8ff7afc89d6201c16 (patch) | |
tree | 935ddc2337b3891aab1ad7edcb06a62aabf14668 /doc/src/declarative | |
parent | 5f63321e3fe2b436d469d2722dc464ea4c7830c4 (diff) | |
download | Qt-33eb76f050b45718d87926a8ff7afc89d6201c16.zip Qt-33eb76f050b45718d87926a8ff7afc89d6201c16.tar.gz Qt-33eb76f050b45718d87926a8ff7afc89d6201c16.tar.bz2 |
Replace QmlList* and QList* support with a single QmlListProperty type
As a value type QmlListProperty doesn't consume any memory in the object.
It also has a companion QmlListReference class that is part of the public
API for C++ developers to interact with that also manages memory issues
that existed with previous solutions (if the containing QObject was
destroyed it left a dangling pointer).
Diffstat (limited to 'doc/src/declarative')
-rw-r--r-- | doc/src/declarative/extending-examples.qdoc | 14 | ||||
-rw-r--r-- | doc/src/declarative/extending.qdoc | 2 | ||||
-rw-r--r-- | doc/src/declarative/qmlmodels.qdoc | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/doc/src/declarative/extending-examples.qdoc b/doc/src/declarative/extending-examples.qdoc index e92fa04..cce3e08 100644 --- a/doc/src/declarative/extending-examples.qdoc +++ b/doc/src/declarative/extending-examples.qdoc @@ -105,15 +105,15 @@ The BirthdayParty class is declared like this: \snippet examples/declarative/extending/properties/birthdayparty.h 3 The class contains a member to store the celebrant object, and also a -QmlConcreteList<Person *> member. +QList<Person *> member. In QML, the type of a list properties - and the guests property is a list of -people - are all of type QmlList<T *>*. QmlList is an abstract list interface -that allows a developer to react to QML accessing and modifying the contents of -the list. This is useful for implementing "virtual lists" or other advanced -scenarios, but can't be used directly for the common case of just wanting a -regular list of things. For this a concrete implementation, QmlConcreteList, is -provided and that is used here. +people - are all of type QmlListProperty<T>. QmlListProperty is simple value +type that contains a set of function pointers. QML calls these function +pointers whenever it needs to read from, write to or otherwise interact with +the list. In addition to concrete lists like the people list used in this +example, the use of QmlListProperty allows for "virtual lists" and other advanced +scenarios. \section2 Define the BirthdayParty diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index c75c22e..1307ea9 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -169,7 +169,7 @@ for assignment to appropriately typed properties. The guests property is a list of \c Person objects. Properties that are lists of objects or Qt interfaces are also declared with the Q_PROPERTY() macro, just -like other properties. List properties must have the type \c {QmlList<T *>*}. +like other properties. List properties must have the type \c {QmlListProperty<T>}. As with object properties, the type \a T must be registered with QML. The guest property declaration looks like this: diff --git a/doc/src/declarative/qmlmodels.qdoc b/doc/src/declarative/qmlmodels.qdoc index c898c07..39119e5 100644 --- a/doc/src/declarative/qmlmodels.qdoc +++ b/doc/src/declarative/qmlmodels.qdoc @@ -258,7 +258,7 @@ dataList.append(new DataObject("Item 3", "blue")); dataList.append(new DataObject("Item 4", "yellow")); QmlContext *ctxt = view.rootContext(); -ctxt->setContextProperty("myModel", QVariant::fromValue(&dataList)); +ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); \endcode The properties of the object may then be accessed in the delegate: |