|
|
|
@ -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) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|