diff options
| author | Lorn Potter <lorn.potter@nokia.com> | 2010-07-30 00:33:37 (GMT) |
|---|---|---|
| committer | Lorn Potter <lorn.potter@nokia.com> | 2010-07-30 00:33:37 (GMT) |
| commit | 96dc38a1a971b2bb9d62d440943a3d0b2e44fb0c (patch) | |
| tree | 6e8f0b0b125d0f03529cb0fb07f686d34c6b7daf /src/declarative/qml/qdeclarativecomponent.cpp | |
| parent | 829833e16644beab6077d07ad80f3a2b148f4e41 (diff) | |
| parent | 597a842d66dc04181bfd063863216acbb11ce3bc (diff) | |
| download | Qt-96dc38a1a971b2bb9d62d440943a3d0b2e44fb0c.zip Qt-96dc38a1a971b2bb9d62d440943a3d0b2e44fb0c.tar.gz Qt-96dc38a1a971b2bb9d62d440943a3d0b2e44fb0c.tar.bz2 | |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/declarative/qml/qdeclarativecomponent.cpp')
| -rw-r--r-- | src/declarative/qml/qdeclarativecomponent.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 7bc6184..1d48b1a 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -115,26 +115,10 @@ class QByteArray; a small component within a QML file, or for defining a component that logically belongs with other QML components within a file. - For example, here is a component that is used by multiple \l Loader objects: + For example, here is a component that is used by multiple \l Loader objects. + It contains a top level \l Rectangle item: - \qml - Item { - width: 100; height: 100 - - Component { - id: redSquare - - Rectangle { - color: "red" - width: 10 - height: 10 - } - } - - Loader { sourceComponent: redSquare } - Loader { sourceComponent: redSquare; x: 20 } - } - \endqml + \snippet doc/src/snippets/declarative/component.qml 0 Notice that while a \l Rectangle by itself would be automatically rendered and displayed, this is not the case for the above rectangle @@ -143,12 +127,16 @@ class QByteArray; file, and is not loaded until requested (in this case, by the two \l Loader objects). + A Component cannot contain anything other + than an \c id and a single top level item. While the \c id is optional, + the top level item is not; you cannot define an empty component. + The Component element is commonly used to provide graphical components for views. For example, the ListView::delegate property requires a Component to specify how each list item is to be displayed. - Component objects can also be dynamically generated using - \l{Qt::createComponent()}{Qt.createComponent()}. + Component objects can also be dynamically created using + \l{QML:Qt::createComponent()}{Qt.createComponent()}. */ /*! @@ -609,6 +597,9 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q the \a parent value. Note that if the returned object is to be displayed, you must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent} property, or else the object will not be visible. + + Dynamically created instances can be deleted with the \c destroy() method. + See \l {Dynamic Object Management} for more information. */ /*! |
