我想SwipeView
用Tumbler
QML 中的 a 替换 a ,因为我更喜欢这样的概念,即没有 first 也没有 last Item
。问题是,我找不到任何其他方法可以使这种Tumbler
翻滚水平而不是垂直,而是将其旋转 -90°,然后将Item
s 向后旋转 +90°
到目前为止,这是我的代码,并且按预期工作:
import QtQuick 2.5
import QtQuick.Controls 2.0
import QtQuick.Window 2.2
Window {
id: root
visible: true
width: 640
height: 480
Row {
id: buttons
spacing: 2
Button {
text: '0'
onClicked: tumbl.currentIndex = 0
}
Button {
text: '1'
onClicked: tumbl.currentIndex = 1
}
Button {
text: '2'
onClicked: tumbl.currentIndex = 2
}
Button {
text: '3'
onClicked: tumbl.currentIndex = 3
}
}
Tumbler {
id: tumbl
rotation: -90 // <---- Rotate there
anchors {
top: buttons.bottom
left: buttons.left
right: buttons.right
bottom: parent.bottom
}
model: 4
delegate: Rectangle {
rotation: 90 // <---- Rotate back
color: 'red'
border.width: 15
Text {
anchors.centerIn: parent
text: index
}
}
visibleItemCount: 1
Component.onCompleted: contentItem.interactive = false
}
}
您可以看到这两行,我在其中进行了带有注释的旋转。
有没有人知道一种方法来产生这种圆形行为,SwipeView
或者在没有这种旋转技巧的情况下改变滚筒的翻转方向?