diff options
author | David Boddie <david.boddie@nokia.com> | 2011-01-24 14:09:14 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-01-24 14:09:14 (GMT) |
commit | 3d769613d5efc642ebfd8d5fe7c149834132fe65 (patch) | |
tree | bf7eef1cfc64a13162ea9994ccd1223d8ee0ebf8 /src/declarative/util | |
parent | cdb2d3db1ece08af9ccf844cae6a5d3fa69a0d98 (diff) | |
download | Qt-3d769613d5efc642ebfd8d5fe7c149834132fe65.zip Qt-3d769613d5efc642ebfd8d5fe7c149834132fe65.tar.gz Qt-3d769613d5efc642ebfd8d5fe7c149834132fe65.tar.bz2 |
Doc: Fixed the syntax of QML code snippets.
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qdeclarativestategroup.cpp | 48 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 13 |
2 files changed, 36 insertions, 25 deletions
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index 7aeea12..f1d0997 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -102,10 +102,10 @@ public: id: myStateGroup states: State { name: "state1" - ... + // ... } transitions: Transition { - ... + // ... } } @@ -140,11 +140,15 @@ QList<QDeclarativeState *> QDeclarativeStateGroup::states() const \qml StateGroup { - states: [ - State { ... }, - State { ... } - ... - ] + states: [ + State { + // State definition... + }, + State { + // ... + } + // Other states... + ] } \endqml @@ -197,11 +201,15 @@ void QDeclarativeStateGroupPrivate::clear_states(QDeclarativeListProperty<QDecla \qml StateGroup { - transitions: [ - Transition { ... }, - Transition { ... } - ... - ] + transitions: [ + Transition { + // ... + }, + Transition { + // ... + } + // ... + ] } \endqml @@ -221,14 +229,14 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeStateGroup::transit This property is often used in scripts to change between states. For example: - \qml - function toggle() { - if (button.state == 'On') - button.state = 'Off'; - else - button.state = 'On'; - } - \endqml + \js + function toggle() { + if (button.state == 'On') + button.state = 'Off'; + else + button.state = 'On'; + } + \endjs If the state group is in its base state (i.e. no explicit state has been set), \c state will be a blank string. Likewise, you can return a diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 7da4ecd..c582df1 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -90,8 +90,11 @@ typedef QPair<int, int> QDeclarativeXmlListRange; \qml XmlListModel { id: xmlModel - ... - XmlRole { name: "title"; query: "title/string()" } + // ... + XmlRole { + name: "title" + query: "title/string()" + } } ListView { @@ -792,9 +795,9 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati This will access the \c title value for the first item in the model: - \qml - var title = model.get(0).title; - \endqml + \js + var title = model.get(0).title; + \endjs */ QScriptValue QDeclarativeXmlListModel::get(int index) const { |