[vlc-commits] qml: SortControl respect focusPolicy upon popup closes

Fatih Uzunoglu git at videolan.org
Mon Dec 7 10:08:40 UTC 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Dec  4 02:01:56 2020 +0300| [89a2975615343103bb1a2b333982010bf42d6261] | committer: Pierre Lamot

qml: SortControl respect focusPolicy upon popup closes

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

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

 modules/gui/qt/playlist/qml/PlaylistToolbar.qml | 6 ++----
 modules/gui/qt/widgets/qml/SortControl.qml      | 5 ++++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
index f40411598d..b74f98384a 100644
--- a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
@@ -84,6 +84,8 @@ Widgets.NavigableFocusScope {
                 enabled: !mainPlaylistController.empty
                 popupAlignment: Qt.AlignRight | Qt.AlignTop
 
+                focusPolicy: Qt.NoFocus
+
                 model: [
                     { text: i18n.qtr("Title"),            criteria: PlaylistControllerModel.SORT_KEY_TITLE },
                     { text: i18n.qtr("Duration"),         criteria: PlaylistControllerModel.SORT_KEY_DURATION },
@@ -103,10 +105,6 @@ Widgets.NavigableFocusScope {
                     root.sortPL(modelData.criteria)
                 }
 
-                Keys.priority: Keys.AfterItem
-                Keys.onPressed: defaultKeyAction(event, 0)
-                navigationParent: playlistToolbar
-
                 _colors: playlistToolbar._colors
 
                 sortOrder: mainPlaylistController.sortOrder
diff --git a/modules/gui/qt/widgets/qml/SortControl.qml b/modules/gui/qt/widgets/qml/SortControl.qml
index 73fec4bc46..a9b91810bb 100644
--- a/modules/gui/qt/widgets/qml/SortControl.qml
+++ b/modules/gui/qt/widgets/qml/SortControl.qml
@@ -108,13 +108,16 @@ Widgets.NavigableFocusScope {
 
             button.KeyNavigation.down = list
             button.highlighted = true
+
             list.forceActiveFocus()
         }
 
         onClosed: {
             button.KeyNavigation.down = null
             button.highlighted = false
-            button.forceActiveFocus()
+
+            if (button.focusPolicy !== Qt.NoFocus)
+                button.forceActiveFocus()
         }
 
         contentItem: ListView {



More information about the vlc-commits mailing list