[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: set cursor to busy in ListViewExt by footer drop area...

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 22 09:50:32 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
3698e099 by Fatih Uzunoglu at 2024-11-22T09:24:59+00:00
qml: set cursor to busy in ListViewExt by footer drop area...

until the drop operation finishes

- - - - -
832cd8b6 by Fatih Uzunoglu at 2024-11-22T09:24:59+00:00
qml: set cursor to busy in ListViewExt by the default delegate drop areas...

until the drop operation finishes

- - - - -


3 changed files:

- modules/gui/qt/playlist/qml/PlaylistDelegate.qml
- modules/gui/qt/widgets/qml/ListViewExt.qml
- modules/gui/qt/widgets/qml/TableViewDelegate.qml


Changes:

=====================================
modules/gui/qt/playlist/qml/PlaylistDelegate.qml
=====================================
@@ -318,5 +318,7 @@ T.Control {
     Widgets.ListViewExt.VerticalDropAreaLayout {
         id: dropAreaLayout
         anchors.fill: parent
+
+        view: delegate.view
     }
 }


=====================================
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)
             }
         }
     }
@@ -246,6 +263,13 @@ ListView {
 
                 property bool dropOperationOngoing: false
 
+                onDropOperationOngoingChanged: {
+                    if (dropOperationOngoing)
+                        MainCtx.setCursor(root, Qt.BusyCursor)
+                    else
+                        MainCtx.unsetCursor(root)
+                }
+
                 onEntered: function(drag) {
                     if (!root.isDropAcceptableFunc || !root.isDropAcceptableFunc(drag, root.model.rowCount())
                             || !root.acceptDropFunc) {


=====================================
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
     }
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/182e55167a130a08fb7ab5dff566bb67bd1e1e01...832cd8b6038e92b9027baf90269ffb497d1b422e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/182e55167a130a08fb7ab5dff566bb67bd1e1e01...832cd8b6038e92b9027baf90269ffb497d1b422e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list