Browse Source

qml: set cursor to busy in ListViewExt by the default delegate drop areas...

until the drop operation finishes
pull/175/head
Fatih Uzunoglu 2 years ago
committed by Steve Lhomme
parent
commit
832cd8b603
  1. 2
      modules/gui/qt/playlist/qml/PlaylistDelegate.qml
  2. 21
      modules/gui/qt/widgets/qml/ListViewExt.qml
  3. 2
      modules/gui/qt/widgets/qml/TableViewDelegate.qml

2
modules/gui/qt/playlist/qml/PlaylistDelegate.qml

@ -318,5 +318,7 @@ T.Control {
Widgets.ListViewExt.VerticalDropAreaLayout {
id: dropAreaLayout
anchors.fill: parent
view: delegate.view
}
}

21
modules/gui/qt/widgets/qml/ListViewExt.qml

@ -119,6 +119,8 @@ ListView {
property var isDropAcceptable
property var acceptDrop
property Item view
readonly property point dragPosition: {
let area = null
@ -133,6 +135,21 @@ ListView {
return Qt.point(drag.x, drag.y)
}
function commonDrop(targetIndex, drop) {
const promise = acceptDrop(targetIndex, drop)
if (view) {
MainCtx.setCursor(view, Qt.BusyCursor)
promise.then(() => {
// NOTE: check view again for the unlikely case it is
// gone by the time the promise is resolved:
if (view)
MainCtx.unsetCursor(view)
})
}
}
// NOTE: Nested inline components are not supported in QML as of Qt 6.8
DropArea {
id: higherDropArea
@ -153,7 +170,7 @@ ListView {
onDropped: (drop) => {
console.assert(acceptDrop)
acceptDrop(index, drop)
commonDrop(index, drop)
}
}
@ -177,7 +194,7 @@ ListView {
onDropped: (drop) => {
console.assert(acceptDrop)
acceptDrop(index + 1, drop)
commonDrop(index + 1, drop)
}
}
}

2
modules/gui/qt/widgets/qml/TableViewDelegate.qml

@ -291,5 +291,7 @@ T.Control {
Widgets.ListViewExt.VerticalDropAreaLayout {
id: dropAreaLayout
anchors.fill: parent
view: delegate.ListView.view
}
}

Loading…
Cancel
Save