[vlc-devel] [PATCH 09/16] qml: add drag and drop support int VideoDisplay
Prince Gupta
guptaprince8832 at gmail.com
Fri Dec 4 12:19:06 CET 2020
---
.../gui/qt/medialibrary/qml/VideoDisplay.qml | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
index 0722ddd2d8..b9a3cfe55e 100644
--- a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
@@ -113,6 +113,7 @@ Widgets.NavigableFocusScope {
id: videoGridItem
opacity: videosGV.expandIndex !== -1 && videosGV.expandIndex !== videoGridItem.index ? .7 : 1
+ dragItem: videoDragItem
onContextMenuButtonClicked: {
videosGV.rightClickOnItem(index)
@@ -174,6 +175,7 @@ Widgets.NavigableFocusScope {
height: view.height
width: view.width
model: videoModel
+ dragItem: videoDragItem
navigationParent: root
selectionDelegateModel: selectionModel
@@ -185,6 +187,28 @@ Widgets.NavigableFocusScope {
}
}
+
+ Widgets.DragItem {
+ id: videoDragItem
+
+ function updateComponents(maxCovers) {
+ var items = selectionModel.selectedIndexes.slice(0, maxCovers).map(function (x){
+ return videoModel.getDataAt(x.row)
+ })
+ var title = items.map(function (item){ return item.title}).join(", ")
+ var covers = items.map(function (item) { return {artwork: item.thumbnail || VLCStyle.noArtCover}})
+ return {
+ covers: covers,
+ title: title,
+ count: selectionModel.selectedIndexes.length
+ }
+ }
+
+ function insertIntoPlaylist(index) {
+ medialib.insertIntoPlaylist(index, videoModel.getIdsForIndexes(selectionModel.selectedIndexes))
+ }
+ }
+
Widgets.StackViewExt {
id: view
anchors.fill:parent
--
2.25.1
More information about the vlc-devel
mailing list