SwipeDelegate是否适用于水平方向?

时间:2018-10-11 11:14:30

标签: qt qml

在默认的垂直方向上,一切都会按预期进行。但是对于水平方向,滑动方向没有改变,我找不到swipe.up,swipe.down或类似的内容。有解决方案或解决方法吗?

import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Window 2.11

ApplicationWindow {
    title: "Hello World"
    width: 640
    height: 480

    visible: true

    ListView {
        id: listView
        anchors.fill: parent
        orientation: ListView.Horizontal

        model: 20
        delegate: SwipeDelegate {
            id: swipeDelegate
            text: modelData
            width: 50
            height: root.height

            swipe.behind: Label {
                id: deleteLabel
                text: qsTr("Delete")
                color: "white"
                verticalAlignment: Label.AlignVCenter
                padding: 12
                height: parent.height
                anchors.right: parent.right

                background: Rectangle {
                    color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
                }
            }
        }
    }
}

0 个答案:

没有答案