[vlc-devel] [PATCH 13/17] qml: add context menu in MusicTracksDisplay
Prince Gupta
guptaprince8832 at gmail.com
Fri Jun 19 16:06:26 CEST 2020
---
.../medialibrary/qml/MusicTracksDisplay.qml | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
index 6a96b364ab..9bf6a575d4 100644
--- a/modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
@@ -27,6 +27,29 @@ Widgets.NavigableFocusScope {
property alias sortModel: tracklistdisplay_id.sortModel
property alias model: tracklistdisplay_id.model
+ Widgets.MenuExt {
+ id: contextMenu
+ property var model: ({})
+ closePolicy: Popup.CloseOnReleaseOutside | Popup.CloseOnEscape
+
+ Widgets.MenuItemExt {
+ id: playMenuItem
+ text: "Play from start"
+ onTriggered: {
+ medialib.addAndPlay( contextMenu.model.id )
+ history.push(["player"])
+ }
+ }
+
+ Widgets.MenuItemExt {
+ text: "Enqueue"
+ onTriggered: medialib.addToPlaylist( contextMenu.model.id )
+ }
+
+ onClosed: contextMenu.parent.forceActiveFocus()
+
+ }
+
MusicTrackListDisplay {
id: tracklistdisplay_id
anchors.fill: parent
@@ -39,6 +62,11 @@ Widgets.NavigableFocusScope {
else
tracklistdisplay_id.currentIndex = 0;
}
+
+ onContextMenuButtonClicked: {
+ contextMenu.model = menuModel
+ contextMenu.popup(menuParent)
+ }
}
EmptyLabel {
--
2.25.1
More information about the vlc-devel
mailing list