У меня есть SwipeView, а внутри у меня есть повторитель с SwipeDelegate. Проблема в том, что иногда, когда я пролистываю элемент повторителя, он регистрируется как SwipeDelegate, который я хочу, но иногда он регистрируется как свайп в SwipeView и изменяет страницу, которая мне не нужна. Код ниже для ясности.
Можно ли в любом случае отдавать приоритет SwipeDelegate, чтобы он всегда имел приоритет над SwipeView? Или это просто плохая практика для реализации этого типа вложенных областей смахивания?
Я попытался использовать z-порядок, как показано в коде, но это не помогает.
TabBar {
id: appTabBar
contentContainer: swipeView
TabButton {
text: "Add History"
}
TabButton {
text: "View History"
}
}
QC2.SwipeView {
id: swipeView
anchors.top: appTabBar.bottom
anchors.bottom: parent.bottom
width: parent.width
clip: true
z: 1
Item {}
Item {
Column {
id: table
width: parent.width
spacing: 3
Repeater {
id: foodTableRepeater
height: dp(20)
model: []
delegate: QC2.SwipeDelegate {
id: swipeDelegate
width: parent.width
Rectangle {
height: parent.height
width: parent.width
color: (index % 2 === 0) ? "#D3F2FF" : "#FFFFFF"
border.color: "blue"
border.width: dp(1)
z: 2
Row {
height: parent.height
width: parent.width
AppText {
id: date
leftPadding: dp(10)
width: parent.width
anchors.verticalCenter: parent.verticalCenter
text: JSFuns.getLocaleDateTime(app.locale, modelData[2], app.use_24)
}
}
}
swipe.right: QC2.Label {
id: deleteLabel
verticalAlignment: QC2.Label.AlignVCenter
padding: 5
width: parent.width * 0.4 / 3
height: parent.height
anchors.right: parent.right
z: 3
Icon {
width: parent.width
anchors.verticalCenter: parent.verticalCenter
icon: IconType.close
size: parent.height
color: "red"
}
QC2.SwipeDelegate.onClicked: console.debug(index)
background: Rectangle {
color: deleteLabel.QC2.SwipeDelegate.pressed ?
Qt.darker(app.color_secondary_light, 1.1) :
app.color_secondary_light
}
}
}
}
}
}
}