SwipeView 不垂直滚动
SwipeView don't scrolling in vertical
我遇到了与 this 相同的问题,但使用的是 Qt 和 QML。
我希望能够水平滑动,但也希望在某些带有滚动条的页面上垂直滚动,以便用户可以,例如提交表格。
使用Flickable
with an attached ScrollBar
:
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
ApplicationWindow {
id: window
width: 400
height: 300
visible: true
SwipeView {
anchors.fill: parent
Rectangle {
Text {
text: "Page 1"
anchors.centerIn: parent
}
}
Flickable {
id: listView
contentWidth: width
contentHeight: pane.implicitHeight
ScrollBar.vertical: ScrollBar {}
Pane {
id: pane
GridLayout {
columnSpacing: 10
columns: 2
anchors.fill: parent
Label { text: "Label" }
Button { text: "Button" }
Label { text: "Label" }
RadioButton { text: "RadioButton" }
Label { text: "Label" }
ComboBox { model: 100 }
Label { text: "Label" }
Button { text: "Button" }
Label { text: "Label" }
RadioButton { text: "RadioButton" }
Label { text: "Label" }
ComboBox { model: 100 }
Label { text: "Label" }
Button { text: "Button" }
Label { text: "Label" }
RadioButton { text: "RadioButton" }
Label { text: "Label" }
ComboBox { model: 100 }
}
}
}
Rectangle {
visible: SwipeView.isCurrentItem
Text {
text: "Page 3"
anchors.centerIn: parent
}
}
}
}
我遇到了与 this 相同的问题,但使用的是 Qt 和 QML。
我希望能够水平滑动,但也希望在某些带有滚动条的页面上垂直滚动,以便用户可以,例如提交表格。
使用Flickable
with an attached ScrollBar
:
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
ApplicationWindow {
id: window
width: 400
height: 300
visible: true
SwipeView {
anchors.fill: parent
Rectangle {
Text {
text: "Page 1"
anchors.centerIn: parent
}
}
Flickable {
id: listView
contentWidth: width
contentHeight: pane.implicitHeight
ScrollBar.vertical: ScrollBar {}
Pane {
id: pane
GridLayout {
columnSpacing: 10
columns: 2
anchors.fill: parent
Label { text: "Label" }
Button { text: "Button" }
Label { text: "Label" }
RadioButton { text: "RadioButton" }
Label { text: "Label" }
ComboBox { model: 100 }
Label { text: "Label" }
Button { text: "Button" }
Label { text: "Label" }
RadioButton { text: "RadioButton" }
Label { text: "Label" }
ComboBox { model: 100 }
Label { text: "Label" }
Button { text: "Button" }
Label { text: "Label" }
RadioButton { text: "RadioButton" }
Label { text: "Label" }
ComboBox { model: 100 }
}
}
}
Rectangle {
visible: SwipeView.isCurrentItem
Text {
text: "Page 3"
anchors.centerIn: parent
}
}
}
}