import QtQuick 2.5
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Rectangle {
width: 640
height: 480
color: "#333333"
Button {
id: button
text: "Button"
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 6
onClicked: {
var count = layout.count
if(layout.currentIndex == count - 1)
layout.currentIndex = 0
else
layout.currentIndex ++
}
}
StackLayout {
id: layout
anchors.top: button.bottom
anchors.topMargin: 6
anchors.horizontalCenter: parent.horizontalCenter
width: 480
height: 320
currentIndex: 1
Rectangle {
color: 'teal'
implicitWidth: 200
implicitHeight: 200
}
Rectangle {
color: 'plum'
implicitWidth: 300
implicitHeight: 200
}
Rectangle {
color: '#c90909'
implicitWidth: 300
implicitHeight: 200
}
Rectangle {
color: 'green'
implicitWidth: 300
implicitHeight: 200
}
Rectangle {
color: 'grey'
implicitWidth: 300
implicitHeight: 200
}
}
}