[vlc-devel] [PATCH 10/16] qml: add drag and drop support in NetworkBrowseDisplay
Prince Gupta
guptaprince8832 at gmail.com
Fri Dec 4 12:19:07 CET 2020
---
.../qt/network/qml/NetworkBrowseDisplay.qml | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
index 0ae9be7919..cfaa704933 100644
--- a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
+++ b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
@@ -66,6 +66,37 @@ Widgets.NavigableFocusScope {
searchRole: "name"
}
+ Widgets.DragItem {
+ id: networkDragItem
+
+ function updateComponents(maxCovers) {
+ var items = selectionModel.selectedIndexes.slice(0, maxCovers).map(function (x){
+ return filterModel.getDataAt(x.row)
+ })
+ var title = items.map(function (item){ return item.name || i18n.qtr("Unknown share")}).join(", ")
+ var covers = items.map(function (item) { return {artwork: item.artwork, cover: custom_cover, type: item.type}})
+ return {
+ covers: covers,
+ title: title,
+ count: selectionModel.selectedIndexes.length
+ }
+ }
+
+ function insertIntoPlaylist(index) {
+ providerModel.insertIntoPlaylist(filterModel.mapIndexesToSource(selectionModel.selectedIndexes), index)
+ }
+
+ Component {
+ id: custom_cover
+
+ NetworkCustomCover {
+ iconSize: networkDragItem.coverSize / 2
+ width: networkDragItem.coverSize / 2
+ height: networkDragItem.coverSize / 2
+ }
+ }
+ }
+
function resetFocus() {
var initialIndex = root.initialIndex
if (initialIndex >= filterModel.count)
@@ -153,6 +184,7 @@ Widgets.NavigableFocusScope {
subtitle: ""
height: VLCStyle.gridCover_network_height + VLCStyle.margin_xsmall + VLCStyle.fontHeight_normal
+ dragItem: networkDragItem
onPlayClicked: playAt(index)
onItemClicked : gridView.leftClickOnItem(modifier, index)
@@ -204,6 +236,7 @@ Widgets.NavigableFocusScope {
onPlayClicked: playAt(index)
}
+ dragItem: networkDragItem
height: view.height
width: view.width
model: filterModel
--
2.25.1
More information about the vlc-devel
mailing list