当我在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")
}
}
}
},这就是我得到的:

发布于 2020-04-11 16:05:22
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")
}
}
}
}https://stackoverflow.com/questions/61157468
复制相似问题