当我在SwipeView中添加带有文本的项目时,它表明所有项目都在同一位置,如果我要预览的话,[[SwipeView效果很好。
代码:
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.3
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
SwipeView {
id: swipeView
x: 195
y: 133
width: 200
height: 200
interactive: true
currentIndex: 1
clip: ture
Item {
id: hello
Text {
id: test
text: qsTr("Hello")
}
}
Item {
id: bye
Text {
id: qrr
text: qsTr("Bye")
}
}
}
}
这就是我得到的:
SwipeView {
id: swipeView
anchors.fill: parent
}
完整代码:
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.3 Window { id: window visible: true width: 640 height: 480 title: qsTr("Hello World") SwipeView { id: swipeView currentIndex: 1 anchors.fill: parent Item { Text { text: qsTr("Hello") } } Item { Text { text: qsTr("Bye") } } } }