[vlc-devel] [PATCH 21/27] qml: SortControl respect focusPolicy upon popup closes

Fatih Uzunoglu fuzun54 at outlook.com
Fri Dec 4 00:01:56 CET 2020


---
 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 {
-- 
2.27.0



More information about the vlc-devel mailing list