[vlc-commits] qml: change itemDoubleClicked signal behaviour in KeyNavigableTableView

Prince Gupta git at videolan.org
Tue Apr 6 13:11:59 UTC 2021


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Mon Mar  1 17:55:39 2021 +0530| [99915725e185833a7af665468fab8ed8d9e5f433] | committer: Pierre Lamot

qml: change itemDoubleClicked signal behaviour in KeyNavigableTableView

don't emit actionForSelection with itemDoubleClicked signal, this makes
table view's itemDoubleClicked signal same as grid item's double clicked
signal

fixes reduntant history point bugs in Album ListView and Genre ListView.

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=99915725e185833a7af665468fab8ed8d9e5f433
---

 modules/gui/qt/medialibrary/qml/MusicAlbums.qml           | 1 +
 modules/gui/qt/medialibrary/qml/MusicArtist.qml           | 1 +
 modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml | 2 +-
 modules/gui/qt/medialibrary/qml/PlaylistMedia.qml         | 1 +
 modules/gui/qt/medialibrary/qml/UrlListDisplay.qml        | 2 +-
 modules/gui/qt/medialibrary/qml/VideoListDisplay.qml      | 1 +
 modules/gui/qt/network/qml/NetworkBrowseDisplay.qml       | 1 +
 modules/gui/qt/widgets/qml/KeyNavigableTableView.qml      | 2 +-
 modules/gui/qt/widgets/qml/TableViewDelegate.qml          | 5 ++---
 9 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/MusicAlbums.qml b/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
index cb2bf205b6..8deb707e65 100644
--- a/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
@@ -230,6 +230,7 @@ Widgets.NavigableFocusScope {
 
             onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes,  menuParent.mapToGlobal(0,0))
             onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
+            onItemDoubleClicked: medialib.addAndPlay( model.id )
 
             Widgets.TableColumns {
                 id: tableColumns
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtist.qml b/modules/gui/qt/medialibrary/qml/MusicArtist.qml
index 8fe689454e..bd40ed6ec6 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtist.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtist.qml
@@ -366,6 +366,7 @@ Widgets.NavigableFocusScope {
                     tableView_id.currentIndex = 0;
             }
 
+            onItemDoubleClicked: medialib.addAndPlay(model.id)
             onContextMenuButtonClicked: trackContextMenu.popup(trackSelectionModel.selectedIndexes, menuParent.mapToGlobal(0,0))
             onRightClick: trackContextMenu.popup(trackSelectionModel.selectedIndexes, globalMousePos)
             dragItem: Widgets.DragItem {
diff --git a/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
index 1ff16eba0f..4a3dedb086 100644
--- a/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
@@ -67,7 +67,7 @@ Widgets.KeyNavigableTableView {
     property alias parentId: rootmodel.parentId
 
     onActionForSelection:  medialib.addAndPlay(model.getIdsForIndexes( selection ))
-
+    onItemDoubleClicked: medialib.addAndPlay(model.id)
     onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, menuParent.mapToGlobal(0,0))
     onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
 
diff --git a/modules/gui/qt/medialibrary/qml/PlaylistMedia.qml b/modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
index 27cc4c9b4e..2adc81938a 100644
--- a/modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
+++ b/modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
@@ -83,6 +83,7 @@ MainInterface.MainTableView {
     //---------------------------------------------------------------------------------------------
 
     onActionForSelection: medialib.addAndPlay(model.getIdsForIndexes(selection))
+    onItemDoubleClicked: medialib.addAndPlay(model.id)
 
     //---------------------------------------------------------------------------------------------
     // Connections
diff --git a/modules/gui/qt/medialibrary/qml/UrlListDisplay.qml b/modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
index 496a9f5ff1..a155635d84 100644
--- a/modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
@@ -64,7 +64,7 @@ Widgets.KeyNavigableTableView {
 
     onActionForSelection: medialib.addAndPlay(model.getIdsForIndexes(
                                                   selection))
-
+    onItemDoubleClicked: medialib.addAndPlay(model.id)
     onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, menuParent.mapToGlobal(0,0))
     onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
 
diff --git a/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
index 36d8f2f9af..d0412dfae4 100644
--- a/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
@@ -44,6 +44,7 @@ MainInterface.MainTableView {
     headerColor: VLCStyle.colors.bg
 
     onActionForSelection: medialib.addAndPlay(model.getIdsForIndexes( selection ))
+    onItemDoubleClicked: medialib.addAndPlay(model.id)
 
     Widgets.TableColumns {
         id: tableColumns
diff --git a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
index 025083037b..db9d413946 100644
--- a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
+++ b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
@@ -305,6 +305,7 @@ Widgets.NavigableFocusScope {
             ]
 
             onActionForSelection: _actionAtIndex(selection[0].row)
+            onItemDoubleClicked: _actionAtIndex(index)
             onContextMenuButtonClicked: contextMenu.popup(filterModel.mapIndexesToSource(selectionModel.selectedIndexes), menuParent.mapToGlobal(0,0))
             onRightClick: contextMenu.popup(filterModel.mapIndexesToSource(selectionModel.selectedIndexes), globalMousePos)
         }
diff --git a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
index 2132206f57..14c8864a1b 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
@@ -32,7 +32,7 @@ NavigableFocusScope {
     signal actionForSelection( var selection )
     signal contextMenuButtonClicked(Item menuParent, var menuModel)
     signal rightClick(Item menuParent, var menuModel, var globalMousePos)
-    signal itemDoubleClicked(var model)
+    signal itemDoubleClicked(var index, var model)
 
     property var sortModel: []
     property Component colDelegate: Widgets.ListLabel {
diff --git a/modules/gui/qt/widgets/qml/TableViewDelegate.qml b/modules/gui/qt/widgets/qml/TableViewDelegate.qml
index e7c4f94b70..9912e54ec9 100644
--- a/modules/gui/qt/widgets/qml/TableViewDelegate.qml
+++ b/modules/gui/qt/widgets/qml/TableViewDelegate.qml
@@ -122,9 +122,8 @@ Rectangle {
         }
 
         onDoubleClicked: {
-            actionForSelection(selectionDelegateModel.selectedIndexes);
-
-            root.itemDoubleClicked(root.model);
+            if (mouse.button === Qt.LeftButton)
+                root.itemDoubleClicked(delegate._index, rowModel)
         }
 
         drag.onActiveChanged: {



More information about the vlc-commits mailing list