diff options
author | David Boddie <david.boddie@nokia.com> | 2011-01-20 16:27:33 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-01-20 16:27:33 (GMT) |
commit | d1c54182a317f29240a607de044c01e7e1dd0e8f (patch) | |
tree | 7ecb392276e707c0e463338f1c3a742e3bd842b8 /src/declarative | |
parent | fcb5e19d892ccff208590b8a37171ef6894fc694 (diff) | |
download | Qt-d1c54182a317f29240a607de044c01e7e1dd0e8f.zip Qt-d1c54182a317f29240a607de044c01e7e1dd0e8f.tar.gz Qt-d1c54182a317f29240a607de044c01e7e1dd0e8f.tar.bz2 |
Doc: Fixed invalid QML snippets and marked up JavaScript correctly.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp | 97 |
1 files changed, 64 insertions, 33 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 24d9b03..2989b75 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -799,10 +799,18 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) This example forwards key events to two lists: \qml - ListView { id: list1 ... } - ListView { id: list2 ... } - Keys.forwardTo: [list1, list2] - focus: true + Item { + ListView { + id: list1 + // ... + } + ListView { + id: list2 + // ... + } + Keys.forwardTo: [list1, list2] + focus: true + } \endqml */ @@ -1341,8 +1349,13 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec refer to the item. For example: \qml - Text { id: myText; ... } - Text { text: myText.text } + Item { + Text { + id: myText + // ... + } + Text { text: myText.text } + } \endqml The identifier is available throughout to the \l {components}{component} @@ -2144,13 +2157,16 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const \o \image declarative-anchors_example.png \o Text anchored to Image, horizontally centered and vertically below, with a margin. \qml - Image { id: pic; ... } + Image { + id: pic + // ... + } Text { id: label anchors.horizontalCenter: pic.horizontalCenter anchors.top: pic.bottom anchors.topMargin: 5 - ... + // ... } \endqml \row @@ -2160,12 +2176,15 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const property of both defaults to 0. \qml - Image { id: pic; ... } + Image { + id: pic + // ... + } Text { id: label anchors.left: pic.right anchors.leftMargin: 5 - ... + // ... } \endqml \endtable @@ -2480,11 +2499,15 @@ QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources() \qml Item { - states: [ - State { ... }, - State { ... } - ... - ] + states: [ + State { + // ... + }, + State { + // ... + } + // ... + ] } \endqml @@ -2502,11 +2525,15 @@ QDeclarativeListProperty<QDeclarativeState> QDeclarativeItemPrivate::states() \qml Item { - transitions: [ - Transition { ... }, - Transition { ... } - ... - ] + transitions: [ + Transition { + // ... + }, + Transition { + // ... + } + // ... + ] } \endqml @@ -2531,11 +2558,15 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi \qml Item { - filter: [ - Blur { ... }, - Reflection { ... } - ... - ] + filter: [ + Blur { + // ... + }, + Reflection { + // ... + } + // ... + ] } \endqml */ @@ -2570,14 +2601,14 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi 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 item is in its base state (i.e. no explicit state has been set), \c state will be a blank string. Likewise, you can return an |