刷卡多的项目在默认情况下SwipeDelegate允许刷卡多的项目,如下面的图片:禁止在SwipeDelegate
正如你所看到的,多刷卡项目同时打开,我想只有一个开放的项目一次意味着如果您打开项目#1,通过打开项目#2,项目#1应该关闭。我怎么能做到这一点?与SwipeDelegate一个ListView
示例代码:
ListView {
id: listView
anchors.fill: parent
delegate: SwipeDelegate {
id: delegate
text: modelData
width: parent.width
swipe.right: Rectangle {
width: parent.width
height: parent.height
Label {
text: qsTr("SOME ACTION BUTTON")
padding: 20
anchors.fill: parent
}
}
}
model: ListModel {
id: listModel
ListElement { text: "Lorem ipsum dolor sit amet" }
ListElement { text: "Curabitur sit amet risus" }
ListElement { text: "Suspendisse vehicula nisi" }
ListElement { text: "Mauris imperdiet libero" }
ListElement { text: "Sed vitae dui aliquet augue" }
ListElement { text: "Praesent in elit eu nulla" }
ListElement { text: "Etiam vitae magna" }
ListElement { text: "Pellentesque eget elit euismod" }
ListElement { text: "Nulla at enim porta" }
ListElement { text: "Fusce tincidunt odio" }
ListElement { text: "Ut non ex a ligula molestie" }
ListElement { text: "Nam vitae justo scelerisque" }
ListElement { text: "Vestibulum pulvinar tellus" }
ListElement { text: "Quisque dignissim leo sed gravida" }
}
ScrollIndicator.vertical: ScrollIndicator { }
}
代码请。 [** help/MCVE **](/ help/mcve) – derM
您能否提供[mcve] –
@derM我添加了一个示例代码,代码是[this official example]的缩小版本(https:// doc。 qt.io/qt-5/qtquickcontrols2-swipetoremove-example.html) – Elsiete