【问题标题】:SwipeView don't scrolling in verticalSwipeView 不垂直滚动
【发布时间】:2018-03-09 10:52:47
【问题描述】:

我和this 有同样的问题,但使用的是 Qt 和 QML。

我希望能够水平滑动,但也可以使用滚动条在某些页面上垂直滚动,以便用户可以例如提交表单。

【问题讨论】:

标签: qt qml scrollbar qtquickcontrols2 swipeview


【解决方案1】:

Flickableattached 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
            }
        }
    }
}

【讨论】:

    猜你喜欢
    • 2019-10-04
    • 1970-01-01
    • 2017-07-30
    • 2021-11-13
    • 1970-01-01
    • 2020-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多