From 89d18c86e093befc2fc8cd7fc852610f6e23696b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 23 Apr 2009 14:58:41 +1000 Subject: Component and ComponentInstance documentation. --- doc/src/declarative/components.qdoc | 2 +- doc/src/declarative/elements.qdoc | 1 + src/declarative/fx/qfxcomponentinstance.cpp | 20 ++++++++++++++++++++ src/declarative/qml/qmlcomponent.cpp | 24 ++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/doc/src/declarative/components.qdoc b/doc/src/declarative/components.qdoc index b5c5ae7..9a6f2dd 100644 --- a/doc/src/declarative/components.qdoc +++ b/doc/src/declarative/components.qdoc @@ -3,7 +3,7 @@ \target components \title Components -A \b component is a reusable, encapsulated Qml element with a well-defined interface. +A \bold component is a reusable, encapsulated Qml element with a well-defined interface. Writing and using components allows you to: \list diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 076ef13..afc3726 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -42,6 +42,7 @@ The following table lists the Qml elements provided by the Qt Declarative module \o \l Script \o \l Bind \o \l Connection +\o \l Component \o \l ListModel \o \l DateTimeFormatter \endlist diff --git a/src/declarative/fx/qfxcomponentinstance.cpp b/src/declarative/fx/qfxcomponentinstance.cpp index d561d05..b456716 100644 --- a/src/declarative/fx/qfxcomponentinstance.cpp +++ b/src/declarative/fx/qfxcomponentinstance.cpp @@ -60,6 +60,16 @@ QML_DEFINE_TYPE(QFxComponentInstance,ComponentInstance); /*! \qmlclass ComponentInstance QFxComponentInstance \brief The ComponentInstance element allows you to instantiate an arbitrary component. + + \code + + + + + + + + \endcode */ QFxComponentInstance::QFxComponentInstance(QFxItem *parent) : QFxItem(*(new QFxComponentInstancePrivate), parent) @@ -73,6 +83,11 @@ QFxComponentInstance::QFxComponentInstance(QFxComponentInstancePrivate &dd, QFxI setOptions(IsFocusRealm); } +/*! + \qmlproperty Component QFxComponentInstance::component + + This property holds the component to instantiate. +*/ QmlComponent *QFxComponentInstance::component() const { Q_D(const QFxComponentInstance); @@ -123,6 +138,11 @@ void QFxComponentInstance::updateSize() } } +/*! + \qmlproperty Item QFxComponentInstance::instance + + This property holds the instantiated component. +*/ QFxItem *QFxComponentInstance::instance() const { Q_D(const QFxComponentInstance); diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index ccc591a..0f60870 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -65,6 +65,30 @@ class QByteArray; \brief The QmlComponent class encapsulates a QML component description. \mainclass */ + +/*! + \qmlclass Component QmlComponent + \brief The Component element encapsulates a QML component description. + + Components are reusable, encapsulated Qml element with a well-defined interface. + They are often defined in \l {components}{Component Files}. + + The \e Component element allows defining components within a QML file. + This can be useful for reusing a small component within a single QML + file, or for defining a component that logically belongs with the + file containing it. + + \code + + + + + + + + + \endcode +*/ QML_DEFINE_TYPE(QmlComponent,Component); /*! -- cgit v0.12