summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-02-25 06:05:19 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-02-25 06:05:19 (GMT)
commitb3613f3f3135afeaa9425b1791567185cbc38435 (patch)
treebdbbd1def8da0b02d766754abd8925971395736e /src
parentb915bc2d710e365e7c9083ba65d08de08ea02f74 (diff)
downloadQt-b3613f3f3135afeaa9425b1791567185cbc38435.zip
Qt-b3613f3f3135afeaa9425b1791567185cbc38435.tar.gz
Qt-b3613f3f3135afeaa9425b1791567185cbc38435.tar.bz2
Document Package
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp27
-rw-r--r--src/declarative/util/qdeclarativepackage.cpp27
2 files changed, 54 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 8114f9b..2402648 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -929,6 +929,33 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q
return stat;
}
+/*!
+ \qmlproperty object VisualDataModel::parts
+
+ The \a parts property selects a VisualDataModel which creates
+ delegates from the part named. This is used in conjunction with
+ the Package element.
+
+ For example, the code below selects a model which creates
+ delegates named \e list from a Package:
+
+ \code
+ VisualDataModel {
+ id: visualModel
+ delegate: Package {
+ Item { Package.name: "list" }
+ }
+ model: myModel
+ }
+
+ ListView {
+ width: 200; height:200
+ model: visualModel.parts.list
+ }
+ \endcode
+
+ \sa Package
+*/
QObject *QDeclarativeVisualDataModel::parts()
{
Q_D(QDeclarativeVisualDataModel);
diff --git a/src/declarative/util/qdeclarativepackage.cpp b/src/declarative/util/qdeclarativepackage.cpp
index 356d7a1..34ae466 100644
--- a/src/declarative/util/qdeclarativepackage.cpp
+++ b/src/declarative/util/qdeclarativepackage.cpp
@@ -46,6 +46,33 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmlclass Package QDeclarativePackage
+ \brief Package provides a collection of named items
+
+ The Package class is currently used in conjunction with
+ VisualDataModel to enable delegates with a shared context
+ to be provided to multiple views.
+
+ Any item within a Package may be assigned a name via the
+ \e {Package.name} attached property.
+
+ The example below creates a Package containing two named items;
+ \e list and \e grid. The third element in the package is parented to whichever
+ delegate it should appear in. This allows an item to move
+ between views.
+
+ \snippet examples/declarative/package/Delegate.qml 0
+
+ These named items are used as the delegates by the two views who
+ reference the special VisualDataModel.parts property to select
+ a model which provides the chosen delegate.
+
+ \snippet examples/declarative/package/view.qml 0
+
+*/
+
+
class QDeclarativePackagePrivate : public QObjectPrivate
{
public: