我有一个TabView
,其中包含3 Tab
秒,我想更改焦点/按下按钮时选择第三个Tab
。我已经尝试了forceActiveFocus
,但它不起作用。
//.qml
TabView {
Tab {
id: redTab
title: "Red"
Rectangle { color: "red" }
}
Tab {
id: blueTab
title: "Blue"
Rectangle { color: "blue" }
}
Tab {
id: greenTab
title: "Green"
Rectangle { color: "green" }
}
}
ToolButton {
inconSource: "lock.png"
onClicked: {
greenTab.forceActiveFocus() // does not work?
}
}