diff options
-rw-r--r-- | doc/src/declarative/qdeclarativeintro.qdoc | 17 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index 4b7dce5..9b96d43 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -160,19 +160,19 @@ characters other than letters, numbers and underscores. JavaScript expressions can be used to assign property values. For example: -\code +\qml Item { width: 100 * 3 height: 50 + 22 } -\endcode +\endqml These expressions can include references to other objects and properties, in which case a \l{Property Binding}{binding} is established: when the value of the expression changes, the property to which the expression is assigned is automatically updated to the new value. For example: -\code +\qml Item { width: 300 height: 300 @@ -183,7 +183,7 @@ Item { color: "yellow" } } -\endcode +\endqml Here, the \l Rectangle object's \c width property is set relative to the width of its parent. Whenever the parent's width changes, the width of the \l Rectangle is @@ -330,7 +330,7 @@ element that attaches \e property. For example, the \l ListView element attaches the \e ListView.isCurrentItem property to each delegate it creates: -\code +\qml Component { id: myDelegate Text { @@ -338,10 +338,13 @@ Component { color: ListView.isCurrentItem ? "red" : "blue" } } +\endqml + +\qml ListView { delegate: myDelegate } -\endcode +\endqml Another example of attached properties is the \l Keys element which attaches properties for handling key presses to @@ -390,6 +393,4 @@ MouseArea { } } \endqml - - */ diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index c582df1..6b13e88 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -96,7 +96,9 @@ typedef QPair<int, int> QDeclarativeXmlListRange; query: "title/string()" } } + \endqml + \qml ListView { model: xmlModel delegate: Text { text: title } |