how to correctly switch between pages according following samples:
import QtQuick 2.6
import QtQuick.Layouts 1.0
import Qt.labs.controls 1.0
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
StackView {
id: stack
anchors.fill: parent
initialItem: hal1
}
Pane {
id: hal1
anchors.fill: parent
background: Rectangle {
id: mystart
anchors.centerIn: parent
color: "#2196F3"
}
}
Pane {
id: hal2
anchors.fill: parent
Label {
text: qsTr("Second page")
anchors.centerIn: parent
}
}
footer: TabBar {
id: tabBar
currentIndex: 0
TabButton {
text: qsTr("First")
onClicked: {
if(stack.currentItem==hal1){
console.log("dont switch hal1 !")
return
}
stack.replace(hal1)
}
}
TabButton {
text: qsTr("Second")
onClicked: {
if(stack.currentItem==hal2){
console.log("dont switch hal2 !!")
return
}
stack.replace(hal2)
}
}
}
}
Whenever clicking the first tab I want to get the rectangle and the second tab I want to get my simple label. I'm using qt labs controls 5.6 thanks
EDIT: Look like this code only works for debug build not for release build. Tested on msvc2015 windows. I do not know exactly why this happen, any pointers?
Ok I attached another sample project here to make this case clearer. There are two problems here the first thing is I get warning message "StackView replace nothing to push" and inconsistency behaivor between debug and release build. The debug build is working fine and I get unexpected result at release build.