summaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-11-23 03:44:08 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-11-23 03:44:08 (GMT)
commitd07d71ff11c522cd5401e97b3231b037c38bbd9f (patch)
treeee3a27e945988bfb9cf7e6cdeaf2ed843b06d9c9 /examples/declarative
parenta42f90483e0adc0199f54fde66ab17b2fb019954 (diff)
parent8386980c83a7d0377b8b642a6cec41641070db77 (diff)
downloadQt-d07d71ff11c522cd5401e97b3231b037c38bbd9f.zip
Qt-d07d71ff11c522cd5401e97b3231b037c38bbd9f.tar.gz
Qt-d07d71ff11c522cd5401e97b3231b037c38bbd9f.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples/declarative')
-rw-r--r--examples/declarative/tabwidget/TabWidget.qml42
-rw-r--r--examples/declarative/tabwidget/tabs.qml29
2 files changed, 71 insertions, 0 deletions
diff --git a/examples/declarative/tabwidget/TabWidget.qml b/examples/declarative/tabwidget/TabWidget.qml
new file mode 100644
index 0000000..c56f41e
--- /dev/null
+++ b/examples/declarative/tabwidget/TabWidget.qml
@@ -0,0 +1,42 @@
+import Qt 4.6
+
+Item {
+ id: page
+ 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: page.width / stack.children.length
+ height: 15
+ color: page.current == index ? "grey" : "lightGrey"
+ Text {
+ anchors.fill: parent
+ text: stack.children[index].title
+ elide: Text.ElideRight
+ }
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: page.current = index
+ }
+ }
+ model: stack.children.length
+ }
+ }
+ Item {
+ id: stack
+ anchors.top: header.bottom
+ anchors.bottom: page.bottom
+ width: page.width
+ }
+}
diff --git a/examples/declarative/tabwidget/tabs.qml b/examples/declarative/tabwidget/tabs.qml
new file mode 100644
index 0000000..54ed7df
--- /dev/null
+++ b/examples/declarative/tabwidget/tabs.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+TabWidget {
+ id: tabs
+ width: 200
+ height: 200
+ current: 2
+ Rectangle {
+ property string title: "Red"
+ color: "red"
+ anchors.fill: parent
+ Text { anchors.centerIn: parent; text: "<div align=center>Roses are red"; font.pixelSize: 24
+ wrap: true; width: parent.width-20 }
+ }
+ Rectangle {
+ property string title: "Green"
+ color: "green"
+ anchors.fill: parent
+ Text { anchors.centerIn: parent; text: "<div align=center>Flower stems are green"; font.pixelSize: 24;
+ wrap: true; width: parent.width-20 }
+ }
+ Rectangle {
+ property string title: "Blue"
+ color: "blue"
+ anchors.fill: parent
+ Text { anchors.centerIn: parent; text: "<div align=center>Violets are blue"; color: "white"; font.pixelSize: 24
+ wrap: true; width: parent.width-20 }
+ }
+}