summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@nokia.com>2010-05-27 11:59:59 +0200
committerThomas Hartmann <Thomas.Hartmann@nokia.com>2010-05-27 12:00:12 +0200
commita49bbb4d158a64bf516a29784be55866a5b7a8ef (patch)
tree1cc2b52392f265d7faec885b4cb1b68385bcdb51 /tests
parentfc4e7b2e6de0edce6fc97d5ef4aaf164c440b1c4 (diff)
downloadqt-creator-a49bbb4d158a64bf516a29784be55866a5b7a8ef.tar.gz
QmlDesigner.test: adding qml files
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmldesigner/data/fx/TabWidget.qml57
-rw-r--r--tests/auto/qml/qmldesigner/data/fx/tabs.qml59
2 files changed, 116 insertions, 0 deletions
diff --git a/tests/auto/qml/qmldesigner/data/fx/TabWidget.qml b/tests/auto/qml/qmldesigner/data/fx/TabWidget.qml
new file mode 100644
index 0000000000..26d25b47b5
--- /dev/null
+++ b/tests/auto/qml/qmldesigner/data/fx/TabWidget.qml
@@ -0,0 +1,57 @@
+import Qt 4.7
+
+Item {
+ id: tabWidget
+
+ property int current: 0
+ default property alias content: stack.children
+
+ onCurrentChanged: setOpacities()
+ Component.onCompleted: setOpacities()
+
+ function setOpacities()
+ {
+ for (var i = 0; i < stack.children.length; ++i) {
+ stack.children[i].opacity = i == current ? 1 : 0
+ }
+ }
+
+ Row {
+ id: header
+ Repeater {
+ delegate: Rectangle {
+ width: tabWidget.width / stack.children.length; height: 36
+
+ Rectangle {
+ width: parent.width; height: 1
+ anchors { bottom: parent.bottom; bottomMargin: 1 }
+ color: "#acb2c2"
+ }
+ BorderImage {
+ anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 }
+ border { left: 7; right: 7 }
+ source: "tab.png"
+ visible: tabWidget.current == index
+ }
+ Text {
+ horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter
+ anchors.fill: parent
+ text: stack.children[index].title
+ elide: Text.ElideRight
+ font.bold: tabWidget.current == index
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: tabWidget.current = index
+ }
+ }
+ model: stack.children.length
+ }
+ }
+
+ Item {
+ id: stack
+ width: tabWidget.width
+ anchors.top: header.bottom; anchors.bottom: tabWidget.bottom
+ }
+}
diff --git a/tests/auto/qml/qmldesigner/data/fx/tabs.qml b/tests/auto/qml/qmldesigner/data/fx/tabs.qml
new file mode 100644
index 0000000000..fba203cc24
--- /dev/null
+++ b/tests/auto/qml/qmldesigner/data/fx/tabs.qml
@@ -0,0 +1,59 @@
+import Qt 4.7
+
+TabWidget {
+ id: tabs
+ width: 640; height: 480
+
+ Rectangle {
+ property string title: "Red"
+ anchors.fill: parent
+ color: "#e3e3e3"
+
+ Rectangle {
+ anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 }
+ color: "#ff7f7f"
+ Text {
+ width: parent.width - 20
+ anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+ text: "Roses are red"
+ font.pixelSize: 20
+ wrapMode: Text.WordWrap
+ }
+ }
+ }
+
+ Rectangle {
+ property string title: "Green"
+ anchors.fill: parent
+ color: "#e3e3e3"
+
+ Rectangle {
+ anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 }
+ color: "#7fff7f"
+ Text {
+ width: parent.width - 20
+ anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+ text: "Flower stems are green"
+ font.pixelSize: 20
+ wrapMode: Text.WordWrap
+ }
+ }
+ }
+
+ Rectangle {
+ property string title: "Blue"
+ anchors.fill: parent; color: "#e3e3e3"
+
+ Rectangle {
+ anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 }
+ color: "#7f7fff"
+ Text {
+ width: parent.width - 20
+ anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+ text: "Violets are blue"
+ font.pixelSize: 20
+ wrapMode: Text.WordWrap
+ }
+ }
+ }
+}