是否可以从滑动 View 中删除动画?您可以在其中看到上一页和下一页的过渡。我有很多页面,并且有一个菜单可以选择事件项目,例如:
mainContent.setCurrentIndex(0)
其中 mainContent 是滑动 View 。
// The content changes based on what is clicked on in the menu
SwipeView{
width: mainWindow.width - mainMenuId.width -anchors.leftMargin
id:mainContent
anchors.leftMargin: 20
anchors.topMargin: 20
clip:true
Component.onCompleted: contentItem.interactive = false
currentIndex: 0
Item{PageMain{}}
Item{PageTests{}}
Item{PageData{}}
Item{PageSavedFiles{}}
Item{PageProbe{}}
}
最佳答案
您可以覆盖 contentItem和 disable ListView 的动画,或者,如果您确实不需要 SwipeView 的滑动部分,请使用例如StackLayout相反:
TabBar {
id: bar
width: parent.width
TabButton {
text: qsTr("Home")
}
TabButton {
text: qsTr("Discover")
}
TabButton {
text: qsTr("Activity")
}
}
StackLayout {
width: parent.width
currentIndex: bar.currentIndex
Item {
id: homeTab
}
Item {
id: discoverTab
}
Item {
id: activityTab
}
}
该代码正在使用 TabBar,但我想您已经明白了。 :)
关于qt - QML Swipeview 无动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57056467/