diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-04-13 04:48:47 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-04-13 04:49:32 (GMT) |
commit | 8149e7aa743c178f13452e7292ea41dccc8aec46 (patch) | |
tree | 83ed6171fc9541b328c0d223fbb55793a19fbad6 /examples/declarative/tabwidget | |
parent | 35d0792025d515e81b2bf208aa1fd7dce28096e6 (diff) | |
download | Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.zip Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.gz Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.bz2 |
Fix code style in examples
Diffstat (limited to 'examples/declarative/tabwidget')
-rw-r--r-- | examples/declarative/tabwidget/TabWidget.qml | 21 | ||||
-rw-r--r-- | examples/declarative/tabwidget/tabs.qml | 27 |
2 files changed, 33 insertions, 15 deletions
diff --git a/examples/declarative/tabwidget/TabWidget.qml b/examples/declarative/tabwidget/TabWidget.qml index e6b40fd..26d25b4 100644 --- a/examples/declarative/tabwidget/TabWidget.qml +++ b/examples/declarative/tabwidget/TabWidget.qml @@ -2,6 +2,7 @@ import Qt 4.7 Item { id: tabWidget + property int current: 0 default property alias content: stack.children @@ -18,21 +19,26 @@ Item { Row { id: header Repeater { - delegate: - Rectangle { + delegate: Rectangle { width: tabWidget.width / stack.children.length; height: 36 + Rectangle { - color: "#acb2c2"; width: parent.width; height: 1 + width: parent.width; height: 1 anchors { bottom: parent.bottom; bottomMargin: 1 } + color: "#acb2c2" } BorderImage { - source: "tab.png"; visible: tabWidget.current == index; border.left: 7; border.right: 7 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 + anchors.fill: parent + text: stack.children[index].title + elide: Text.ElideRight + font.bold: tabWidget.current == index } MouseArea { anchors.fill: parent @@ -45,6 +51,7 @@ Item { Item { id: stack - anchors.top: header.bottom; anchors.bottom: tabWidget.bottom; width: tabWidget.width + width: tabWidget.width + anchors.top: header.bottom; anchors.bottom: tabWidget.bottom } } diff --git a/examples/declarative/tabwidget/tabs.qml b/examples/declarative/tabwidget/tabs.qml index e1bbdef..fba203c 100644 --- a/examples/declarative/tabwidget/tabs.qml +++ b/examples/declarative/tabwidget/tabs.qml @@ -6,28 +6,36 @@ TabWidget { Rectangle { property string title: "Red" - anchors.fill: parent; color: "#e3e3e3" + 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; width: parent.width - 20 + text: "Roses are red" + font.pixelSize: 20 + wrapMode: Text.WordWrap } } } Rectangle { property string title: "Green" - anchors.fill: parent; color: "#e3e3e3" + 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; width: parent.width - 20 + text: "Flower stems are green" + font.pixelSize: 20 + wrapMode: Text.WordWrap } } } @@ -35,13 +43,16 @@ TabWidget { 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; width: parent.width - 20 + text: "Violets are blue" + font.pixelSize: 20 + wrapMode: Text.WordWrap } } } |