Some fixes for tests/auto/declarative/examples autotest
authorMartin Jones <martin.jones@nokia.com>
Fri, 27 May 2011 03:39:15 +0000 (13:39 +1000)
committerMartin Jones <martin.jones@nokia.com>
Fri, 27 May 2011 03:39:15 +0000 (13:39 +1000)
Change-Id: I58b4c52c64fc51863f14f50e077c975928e71ebb

doc/src/snippets/declarative/codingconventions/myscript.js [new file with mode: 0644]
doc/src/snippets/declarative/focus/MyClickableWidget.qml [moved from doc/src/snippets/declarative/focus/myclickablewidget.qml with 100% similarity]
doc/src/snippets/declarative/focus/MyWidget.qml [copied from doc/src/snippets/declarative/focus/mywidget.qml with 100% similarity]
doc/src/snippets/declarative/righttoleft/Child.qml [moved from doc/src/snippets/declarative/focus/mywidget.qml with 81% similarity]

diff --git a/doc/src/snippets/declarative/codingconventions/myscript.js b/doc/src/snippets/declarative/codingconventions/myscript.js
new file mode 100644 (file)
index 0000000..cfa6462
--- /dev/null
@@ -0,0 +1,9 @@
+function calculateWidth(parent)
+{
+    var w = parent.width / 3
+    // ...
+    // more javascript code
+    // ...
+    console.debug(w)
+    return w
+}
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
-//! [document]
+
 import QtQuick 1.0
 
-//! [mywidget]
 Rectangle {
-    id: widget
-    color: "lightsteelblue"; width: 175; height: 25; radius: 10; smooth: true
-    Text { id: label; anchors.centerIn: parent}
-    focus: true
-    Keys.onPressed: {
-        if (event.key == Qt.Key_A)
-            label.text = 'Key A was pressed'
-        else if (event.key == Qt.Key_B)
-            label.text = 'Key B was pressed'
-        else if (event.key == Qt.Key_C)
-            label.text = 'Key C was pressed'
+    width: 50; height: 50
+    color: "black"
+    Text {
+        color: "white"
+        text: String.fromCharCode(65 + Math.floor(26*Math.random()))
+        anchors.centerIn: parent
     }
 }
-//! [mywidget]