summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-01-24 14:09:14 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-01-24 14:09:14 (GMT)
commit3d769613d5efc642ebfd8d5fe7c149834132fe65 (patch)
treebf7eef1cfc64a13162ea9994ccd1223d8ee0ebf8 /src/declarative/graphicsitems
parentcdb2d3db1ece08af9ccf844cae6a5d3fa69a0d98 (diff)
downloadQt-3d769613d5efc642ebfd8d5fe7c149834132fe65.zip
Qt-3d769613d5efc642ebfd8d5fe7c149834132fe65.tar.gz
Qt-3d769613d5efc642ebfd8d5fe7c149834132fe65.tar.bz2
Doc: Fixed the syntax of QML code snippets.
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp44
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp5
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp35
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp4
5 files changed, 65 insertions, 33 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index e915bea..a99d918 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2124,16 +2124,18 @@ 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
- // ...
- }
- Text {
- id: label
- anchors.horizontalCenter: pic.horizontalCenter
- anchors.top: pic.bottom
- anchors.topMargin: 5
- // ...
+ Item {
+ Image {
+ id: pic
+ // ...
+ }
+ Text {
+ id: label
+ anchors.horizontalCenter: pic.horizontalCenter
+ anchors.top: pic.bottom
+ anchors.topMargin: 5
+ // ...
+ }
}
\endqml
\row
@@ -2143,16 +2145,18 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
property of both defaults to 0.
\qml
- Image {
- id: pic
- // ...
- }
- Text {
- id: label
- anchors.left: pic.right
- anchors.leftMargin: 5
- // ...
- }
+ Item {
+ Image {
+ id: pic
+ // ...
+ }
+ Text {
+ id: label
+ anchors.left: pic.right
+ anchors.leftMargin: 5
+ // ...
+ }
+ }
\endqml
\endtable
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 4e049c7..e0bd2ff 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -364,9 +364,13 @@ void QDeclarativeBasePositioner::finishApplyTransitions()
\qml
Column {
spacing: 2
- add: ...
- move: ...
- ...
+ add: Transition {
+ // Define an animation for adding a new item...
+ }
+ move: Transition {
+ // Define an animation for moving items within the column...
+ }
+ // ...
}
\endqml
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 403f12c..d962919 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -60,7 +60,10 @@ QT_BEGIN_NAMESPACE
Example:
\qml
- Rectangle { border.width: 2; border.color: "red" ... }
+ Rectangle {
+ border.width: 2
+ border.color: "red"
+ }
\endqml
*/
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 2f3c8e5..79aa18d 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -558,11 +558,24 @@ QPixmap QDeclarativeTextPrivate::drawOutline(const QPixmap &source, const QPixma
\brief The Text item allows you to add formatted text to a scene.
\inherits Item
- A Text item can display both plain and rich text. For example:
+ Text items can display both plain and rich text. For example, red text with
+ a specific font and size can be defined like this:
\qml
- Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" }
- Text { text: "<b>Hello</b> <i>World!</i>" }
+ Text {
+ text: "Hello World!"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ color: "red"
+ }
+ \endqml
+
+ Rich text is defined using HTML-style markup:
+
+ \qml
+ Text {
+ text: "<b>Hello</b> <i>World!</i>"
+ }
\endqml
\image declarative-text.png
@@ -789,12 +802,20 @@ void QDeclarativeText::setText(const QString &n)
The text color.
+ An example of green text defined using hexadecimal notation:
\qml
- //green text using hexadecimal notation
- Text { color: "#00FF00"; ... }
+ Text {
+ color: "#00FF00"
+ text: "green text"
+ }
+ \endqml
- //steelblue text using SVG color name
- Text { color: "steelblue"; ... }
+ An example of steel blue text defined using an SVG color name:
+ \qml
+ Text {
+ color: "steelblue"
+ text: "blue text"
+ }
\endqml
*/
QColor QDeclarativeText::color() const
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 57a2177..cb308f4 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -520,10 +520,10 @@ void QDeclarativeTextInput::select(int start, int end)
It is equivalent to the following snippet, but is faster and easier
to use.
- \qml
+ \js
myTextInput.text.toString().substring(myTextInput.selectionStart,
myTextInput.selectionEnd);
- \endqml
+ \endjs
*/
QString QDeclarativeTextInput::selectedText() const
{