mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-07 03:56:28 +02:00
qml: implement drag support in MusicTrackListDisplay
replaces drag support from MusicTracksDisplay. This way it can be reused in places where MusicTrackListDisplay is used like in expand delegates
This commit is contained in:
parent
b23f655d23
commit
fe12285fa6
@ -71,6 +71,26 @@ Widgets.KeyNavigableTableView {
|
||||
onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, menuParent.mapToGlobal(0,0))
|
||||
onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
|
||||
|
||||
dragItem: Widgets.DragItem {
|
||||
|
||||
function updateComponents(maxCovers) {
|
||||
var items = selectionModel.selectedIndexes.slice(0, maxCovers).map(function (x){
|
||||
return model.getDataAt(x.row)
|
||||
})
|
||||
var title = items.map(function (item){ return item.title}).join(", ")
|
||||
var covers = items.map(function (item) { return {artwork: item.cover || VLCStyle.noArtCover}})
|
||||
return {
|
||||
covers: covers,
|
||||
title: title,
|
||||
count: selectionModel.selectedIndexes.length
|
||||
}
|
||||
}
|
||||
|
||||
function getSelectedInputItem() {
|
||||
return model.getItemsForIndexes(selectionModel.selectedIndexes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Widgets.TableColumns {
|
||||
id: tableColumns
|
||||
|
@ -26,38 +26,18 @@ import "qrc:///main/" as MainInterface
|
||||
|
||||
FocusScope {
|
||||
id: root
|
||||
|
||||
property alias sortModel: tracklistdisplay_id.sortModel
|
||||
property alias model: tracklistdisplay_id.model
|
||||
property alias selectionModel: tracklistdisplay_id.selectionDelegateModel
|
||||
readonly property bool isViewMultiView: false
|
||||
|
||||
Widgets.DragItem {
|
||||
id: trackDragItem
|
||||
|
||||
function updateComponents(maxCovers) {
|
||||
var items = selectionModel.selectedIndexes.slice(0, maxCovers).map(function (x){
|
||||
return model.getDataAt(x.row)
|
||||
})
|
||||
var title = items.map(function (item){ return item.title}).join(", ")
|
||||
var covers = items.map(function (item) { return {artwork: item.cover || VLCStyle.noArtCover}})
|
||||
return {
|
||||
covers: covers,
|
||||
title: title,
|
||||
count: selectionModel.selectedIndexes.length
|
||||
}
|
||||
}
|
||||
|
||||
function getSelectedInputItem() {
|
||||
return model.getItemsForIndexes(selectionModel.selectedIndexes);
|
||||
}
|
||||
}
|
||||
|
||||
MusicTrackListDisplay {
|
||||
id: tracklistdisplay_id
|
||||
|
||||
anchors.fill: parent
|
||||
visible: model.count > 0
|
||||
focus: model.count > 0
|
||||
dragItem: trackDragItem
|
||||
headerTopPadding: VLCStyle.margin_normal
|
||||
Navigation.parentItem: root
|
||||
Navigation.cancelAction: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user