[vlc-commits] qml: add drag and drop support int VideoDisplay
Prince Gupta
git at videolan.org
Thu Dec 10 09:34:51 UTC 2020
vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Thu Nov 12 15:05:08 2020 +0530| [070b7c8f4e77867c59df94d201bfb7f3fcd546a7] | committer: Pierre Lamot
qml: add drag and drop support int VideoDisplay
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=070b7c8f4e77867c59df94d201bfb7f3fcd546a7
---
modules/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
More information about the vlc-commits
mailing list