如何在Qt Quick QML的TabView中更改选项卡 这是我的代码
TabView {
id: main_tab
width: 799
height: 560
tabsVisible: false
Tab {
id: home_tab
source: "Home.qml"
title: "Home"
}
Tab {
id: led_tab
source: "Led.qml"
title: "Led"
}
}
我尝试使用main_tab.getTab(1).active = true
设置新选项卡,但没有成功。
您必须更改TabView
的currentIndex
属性:
main_tab.currentIndex = 0 // Will show home_tab
main_tab.currentIndex = 1 // Will show led_tab