[vlc-commits] qml/PlaylistMediaDisplay: Add keyboard delete support

Benjamin Arnaud git at videolan.org
Mon Mar 15 10:35:01 UTC 2021


vlc | branch: master | Benjamin Arnaud <benjamin.arnaud at videolabs.io> | Thu Mar 11 10:16:59 2021 +0100| [b222021d54ddad7754823e7979e7b29346fe4b31] | committer: Pierre Lamot

qml/PlaylistMediaDisplay: Add keyboard delete support

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b222021d54ddad7754823e7979e7b29346fe4b31
---

 modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml b/modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
index 4a14da18aa..8dd976cb2b 100644
--- a/modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
@@ -108,6 +108,19 @@ Widgets.NavigableFocusScope {
             currentItem.positionViewAtIndex(initialIndex, ItemView.Contain);
     }
 
+    //---------------------------------------------------------------------------------------------
+    // Events
+
+    function onDelete()
+    {
+        var indexes = modelSelect.selectedIndexes;
+
+        if (indexes.length === 0)
+            return;
+
+        model.remove(indexes);
+    }
+
     //---------------------------------------------------------------------------------------------
     // Private
 
@@ -232,6 +245,8 @@ Widgets.NavigableFocusScope {
                                                       menuParent.mapToGlobal(0,0))
 
         onRightClick: contextMenu.popup(modelSelect.selectedIndexes, globalMousePos)
+
+        Keys.onDeletePressed: onDelete()
     }
 
     EmptyLabel {



More information about the vlc-commits mailing list