Skip to content
Snippets Groups Projects
Commit a49bbb4d authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.test: adding qml files

parent fc4e7b2e
No related branches found
No related tags found
No related merge requests found
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
}
}
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
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment