[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml/TableViewDelegate: use IcontoolButton for context button

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jan 1 21:42:59 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
668255fa by Prince Gupta at 2022-01-01T10:32:03+00:00
qml/TableViewDelegate: use IcontoolButton for context button

- - - - -
ec09f7d7 by Prince Gupta at 2022-01-01T10:32:03+00:00
qml/ListViews: improve context menu popup position

- - - - -
f15644a5 by Prince Gupta at 2022-01-01T10:32:03+00:00
qml: remove ContextButton widget

- - - - -


16 changed files:

- modules/gui/qt/Makefile.am
- modules/gui/qt/medialibrary/qml/MediaGroupList.qml
- modules/gui/qt/medialibrary/qml/MusicAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
- modules/gui/qt/medialibrary/qml/MusicArtist.qml
- modules/gui/qt/medialibrary/qml/MusicGenres.qml
- modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
- modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
- modules/gui/qt/vlc.qrc
- − modules/gui/qt/widgets/qml/ContextButton.qml
- modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
- modules/gui/qt/widgets/qml/TableViewDelegate.qml


Changes:

=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -855,7 +855,6 @@ libqt_plugin_la_QML = \
 	gui/qt/widgets/qml/CaptionLabel.qml \
 	gui/qt/widgets/qml/CheckedDelegate.qml \
 	gui/qt/widgets/qml/ComboBoxExt.qml \
-	gui/qt/widgets/qml/ContextButton.qml \
 	gui/qt/widgets/qml/AcrylicBackground.qml \
 	gui/qt/widgets/qml/AnimatedBackground.qml \
 	gui/qt/widgets/qml/CoverShadow.qml \


=====================================
modules/gui/qt/medialibrary/qml/MediaGroupList.qml
=====================================
@@ -374,7 +374,7 @@ FocusScope {
             onItemDoubleClicked: if (model.count > 1) showList(model, Qt.MouseFocusReason)
 
             onContextMenuButtonClicked: contextMenu.popup(modelSelect.selectedIndexes,
-                                                          menuParent.mapToGlobal(0,0))
+                                                          globalMousePos)
 
             onRightClick: contextMenu.popup(modelSelect.selectedIndexes, globalMousePos)
 


=====================================
modules/gui/qt/medialibrary/qml/MusicAlbums.qml
=====================================
@@ -237,7 +237,7 @@ FocusScope {
 
             Navigation.cancelAction: root._onNavigationCancel
 
-            onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes,  menuParent.mapToGlobal(0,0))
+            onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
             onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
             onItemDoubleClicked: MediaLib.addAndPlay( model.id )
 


=====================================
modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
=====================================
@@ -203,7 +203,7 @@ FocusScope {
 
             onItemDoubleClicked: root.requestArtistAlbumView(Qt.MouseFocusReason)
 
-            onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, menuParent.mapToGlobal(0,0))
+            onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
             onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
 
             Widgets.TableColumns {


=====================================
modules/gui/qt/medialibrary/qml/MusicArtist.qml
=====================================
@@ -426,7 +426,7 @@ FocusScope {
             Navigation.cancelAction: root._onNavigationCancel
 
             onItemDoubleClicked: MediaLib.addAndPlay(model.id)
-            onContextMenuButtonClicked: trackContextMenu.popup(trackSelectionModel.selectedIndexes, menuParent.mapToGlobal(0,0))
+            onContextMenuButtonClicked: trackContextMenu.popup(trackSelectionModel.selectedIndexes, globalMousePos)
             onRightClick: trackContextMenu.popup(trackSelectionModel.selectedIndexes, globalMousePos)
 
             dragItem: Widgets.MLDragItem {


=====================================
modules/gui/qt/medialibrary/qml/MusicGenres.qml
=====================================
@@ -267,7 +267,7 @@ FocusScope {
                 root.showAlbumView(model.id, model.name, Qt.MouseFocusReason)
             }
 
-            onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, menuParent.mapToGlobal(0,0))
+            onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
             onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
 
             Widgets.TableColumns {


=====================================
modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
=====================================
@@ -69,7 +69,7 @@ Widgets.KeyNavigableTableView {
 
     onActionForSelection:  MediaLib.addAndPlay(model.getIdsForIndexes( selection ))
     onItemDoubleClicked: MediaLib.addAndPlay(model.id)
-    onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, menuParent.mapToGlobal(0,0))
+    onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
     onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
 
     dragItem: Widgets.MLDragItem {


=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
=====================================
@@ -194,7 +194,7 @@ FocusScope {
         // Events
 
         onContextMenuButtonClicked: contextMenu.popup(modelSelect.selectedIndexes,
-                                                      menuParent.mapToGlobal(0,0))
+                                                      globalMousePos)
 
         onRightClick: contextMenu.popup(modelSelect.selectedIndexes, globalMousePos)
 


=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
=====================================
@@ -384,7 +384,7 @@ FocusScope {
             onItemDoubleClicked: showList(model, Qt.MouseFocusReason)
 
             onContextMenuButtonClicked: contextMenu.popup(modelSelect.selectedIndexes,
-                                                          menuParent.mapToGlobal(0,0))
+                                                          globalMousePos)
 
             onRightClick: contextMenu.popup(modelSelect.selectedIndexes, globalMousePos)
 


=====================================
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))
+    onContextMenuButtonClicked: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
     onRightClick: contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
 
     MLUrlModel {


=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -331,7 +331,7 @@ FocusScope {
             onItemDoubleClicked: g_mainDisplay.play(MediaLib, model.id)
 
             onContextMenuButtonClicked: contextMenu.popup(modelSelect.selectedIndexes,
-                                                          menuParent.mapToGlobal(0,0))
+                                                          globalMousePos)
 
             onRightClick: contextMenu.popup(modelSelect.selectedIndexes, globalMousePos)
         }


=====================================
modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
=====================================
@@ -330,7 +330,7 @@ FocusScope {
 
             onActionForSelection: _actionAtIndex(selection[0].row)
             onItemDoubleClicked: _actionAtIndex(index)
-            onContextMenuButtonClicked: contextMenu.popup(filterModel.mapIndexesToSource(selectionModel.selectedIndexes), menuParent.mapToGlobal(0,0))
+            onContextMenuButtonClicked: contextMenu.popup(filterModel.mapIndexesToSource(selectionModel.selectedIndexes), globalMousePos)
             onRightClick: contextMenu.popup(filterModel.mapIndexesToSource(selectionModel.selectedIndexes), globalMousePos)
         }
     }


=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -232,7 +232,6 @@
         <file alias="SortControl.qml">widgets/qml/SortControl.qml</file>
         <file alias="RoundButton.qml">widgets/qml/RoundButton.qml</file>
         <file alias="LabelSeparator.qml">widgets/qml/LabelSeparator.qml</file>
-        <file alias="ContextButton.qml">widgets/qml/ContextButton.qml</file>
         <file alias="VideoQualityLabels.qml">widgets/qml/VideoQualityLabels.qml</file>
         <file alias="VideoProgressBar.qml">widgets/qml/VideoProgressBar.qml</file>
         <file alias="NavigableCol.qml">widgets/qml/NavigableCol.qml</file>


=====================================
modules/gui/qt/widgets/qml/ContextButton.qml deleted
=====================================
@@ -1,54 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * ( at your option ) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-
-import "qrc:///widgets/" as Widgets
-import "qrc:///style/"
-
-
-Button {
-    id: contextButton
-    width: VLCStyle.icon_normal
-    height: VLCStyle.icon_normal
-    text: VLCIcons.ellipsis
-    font.family: VLCIcons.fontFamily
-    font.pixelSize: VLCIcons.pixelSize(VLCStyle.icon_medium)
-
-    property alias color: contextButtonContent.color
-    property alias backgroundColor: contextButtonBg.color
-
-    hoverEnabled: true
-    background: Rectangle {
-        id: contextButtonBg
-        anchors.fill: contextButton
-        color: "transparent"
-    }
-    contentItem: Text {
-        id: contextButtonContent
-        text: contextButton.text
-        font: contextButton.font
-        color: VLCStyle.colors.text
-        horizontalAlignment: Text.AlignHCenter
-        verticalAlignment: Text.AlignVCenter
-        //                                layer.enabled: true
-        //                                layer.effect: DropShadow {
-        //                                    color: VLCStyle.colors.text
-        //                                }
-    }
-}


=====================================
modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
=====================================
@@ -110,7 +110,7 @@ FocusScope {
 
     //forwarded from subview
     signal actionForSelection( var selection )
-    signal contextMenuButtonClicked(Item menuParent, var menuModel)
+    signal contextMenuButtonClicked(Item menuParent, var menuModel, var globalMousePos)
     signal rightClick(Item menuParent, var menuModel, var globalMousePos)
     signal itemDoubleClicked(var index, var model)
 


=====================================
modules/gui/qt/widgets/qml/TableViewDelegate.qml
=====================================
@@ -188,20 +188,19 @@ T.Control {
 
             height: parent.height
 
-            ContextButton {
+            Widgets.IconToolButton {
                 id: contextButton
 
                 anchors.verticalCenter: parent.verticalCenter
 
-                color: background.foregroundColor
+                iconText: VLCIcons.ellipsis
 
-                backgroundColor: (hovered || activeFocus)
-                                 ? VLCStyle.colors.getBgColor(delegate.selected, hovered, activeFocus)
-                                 : "transparent"
+                size: VLCStyle.icon_medium
 
                 visible: delegate.hovered
 
-                onClicked: root.contextMenuButtonClicked(this, delegate.rowModel)
+                onClicked: root.contextMenuButtonClicked(this, delegate.rowModel
+                                                         , contextButton.mapToGlobal(VLCStyle.margin_xsmall, contextButton.height / 2 + VLCStyle.fontHeight_normal))
             }
         }
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/69372b62e200bfd2ae14cd08396c667b053e80ac...f15644a5ecf759c6acf6631210d135c182170aba

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/69372b62e200bfd2ae14cd08396c667b053e80ac...f15644a5ecf759c6acf6631210d135c182170aba
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list