【发布时间】:2020-04-07 03:55:42
【问题描述】:
在 QML SwipeView documentation 中,它列出了 SwipeView 子项的一些附加属性。例如
SwipeView.index : int
此附加属性保存 SwipeView 中每个子项的索引。
它附加到 SwipeView 的每个子项。
如何从 SwipeView 子项访问这些属性?我注意到正常的 SwipeView 属性不引用 SwipeView. 例如 vertical
最终我想通过提供孩子的附加索引属性来更改 SwipeView 的当前项目,例如
SwipeView {
id: view
currentIndex: aBool ? firstPage.index : secondPage.index
anchors.fill: parent
Item {
id: firstPage
}
Item {
id: secondPage
}
Item {
id: thirdPage
}
}
【问题讨论】: