[vlc-commits] qml: capture mouse events on playlist footer
Fatih Uzunoglu
git at videolan.org
Tue Aug 18 17:14:58 CEST 2020
vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Thu Jul 23 17:13:55 2020 +0300| [e1d52367b5735d4314d8fc183823b5e62f8aec4d] | committer: Pierre Lamot
qml: capture mouse events on playlist footer
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e1d52367b5735d4314d8fc183823b5e62f8aec4d
---
modules/gui/qt/playlist/qml/PlaylistListView.qml | 69 ++++++++++++++++--------
1 file changed, 46 insertions(+), 23 deletions(-)
diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index 2ba99db651..5621d83068 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -310,37 +310,60 @@ Widgets.NavigableFocusScope {
}
}
- footer: DropArea {
+ footer: Item {
width: parent.width
height: Math.max(VLCStyle.icon_normal, view.height - y)
- onEntered: {
- if(drag.source.model.index === root.plmodel.count - 1)
- return
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton | Qt.LeftButton
- root.setItemDropIndicatorVisible(view.modelCount - 1, true, false);
+ onClicked: {
+ if( mouse.button === Qt.RightButton )
+ {
+ view.forceActiveFocus()
+ root.plmodel.deselectAll()
+ contextMenu.model = root.plmodel
+ contextMenu.popup()
+ }
+ else if ( mouse.button === Qt.LeftButton )
+ {
+ view.forceActiveFocus()
+ root.plmodel.deselectAll()
+ }
+ }
}
- onExited: {
- if(drag.source.model.index === root.plmodel.count - 1)
- return
- root.setItemDropIndicatorVisible(view.modelCount - 1, false, false);
- }
- onDropped: {
- if(drag.source.model.index === root.plmodel.count - 1)
- return
+ DropArea {
+ anchors.fill: parent
+ onEntered: {
+ if(drag.source.model.index === root.plmodel.count - 1)
+ return
- if (drop.hasUrls) {
- //force conversion to an actual list
- var urlList = []
- for ( var url in drop.urls)
- urlList.push(drop.urls[url])
- mainPlaylistController.insert(root.plmodel.count, urlList)
- } else {
- root.plmodel.moveItemsPost(root.plmodel.getSelection(), root.plmodel.count - 1)
+ root.setItemDropIndicatorVisible(view.modelCount - 1, true, false);
+ }
+ onExited: {
+ if(drag.source.model.index === root.plmodel.count - 1)
+ return
+
+ root.setItemDropIndicatorVisible(view.modelCount - 1, false, false);
+ }
+ onDropped: {
+ if(drag.source.model.index === root.plmodel.count - 1)
+ return
+
+ if (drop.hasUrls) {
+ //force conversion to an actual list
+ var urlList = []
+ for ( var url in drop.urls)
+ urlList.push(drop.urls[url])
+ mainPlaylistController.insert(root.plmodel.count, urlList)
+ } else {
+ root.plmodel.moveItemsPost(root.plmodel.getSelection(), root.plmodel.count - 1)
+ }
+ root.setItemDropIndicatorVisible(view.modelCount - 1, false, false);
+ drop.accept()
}
- root.setItemDropIndicatorVisible(view.modelCount - 1, false, false);
- drop.accept()
}
}
More information about the vlc-commits
mailing list