summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/codingconventions/javascript.qml
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-04-13 11:05:11 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-04-13 11:05:11 (GMT)
commit6c231c82ac2d277d9593ae46c1309223b185f6fd (patch)
tree723975cb64aed8228908fdba8458c64fe480bbd6 /doc/src/snippets/declarative/codingconventions/javascript.qml
parentf854d363afb6878f3e5260314545d93b9fad41a9 (diff)
parent42fc3d36260c409918431c1fc058ee2d10f6c147 (diff)
downloadQt-6c231c82ac2d277d9593ae46c1309223b185f6fd.zip
Qt-6c231c82ac2d277d9593ae46c1309223b185f6fd.tar.gz
Qt-6c231c82ac2d277d9593ae46c1309223b185f6fd.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'doc/src/snippets/declarative/codingconventions/javascript.qml')
-rw-r--r--doc/src/snippets/declarative/codingconventions/javascript.qml33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/codingconventions/javascript.qml b/doc/src/snippets/declarative/codingconventions/javascript.qml
new file mode 100644
index 0000000..64b5a40
--- /dev/null
+++ b/doc/src/snippets/declarative/codingconventions/javascript.qml
@@ -0,0 +1,33 @@
+import Qt 4.7
+
+Rectangle {
+
+//![0]
+Rectangle { color: "blue"; width: parent.width / 3 }
+//![0]
+
+//![1]
+Rectangle {
+ color: "blue"
+ width: {
+ var w = parent.width / 3
+ console.debug(w)
+ return w
+ }
+}
+//![1]
+
+//![2]
+function calculateWidth(object)
+{
+ var w = object.width / 3
+ // ...
+ // more javascript code
+ // ...
+ console.debug(w)
+ return w
+}
+
+Rectangle { color: "blue"; width: calculateWidth(parent) }
+//![2]
+}