[vlc-devel] [PATCH 29/33] QML: display only the sort and filter controls in BannerSources when needed

Adrien Maglo magsoft at videolan.org
Wed Jun 12 14:01:36 CEST 2019


---
 modules/gui/qt/qml/BannerSources.qml | 38 ++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/qml/BannerSources.qml b/modules/gui/qt/qml/BannerSources.qml
index ec7f4babee..7f7d96062d 100644
--- a/modules/gui/qt/qml/BannerSources.qml
+++ b/modules/gui/qt/qml/BannerSources.qml
@@ -38,7 +38,7 @@ Utils.NavigableFocusScope {
     signal itemClicked(int index)
     signal subItemClicked(int index)
 
-    property alias sortModel: sort_control.model
+    property alias sortModel: sortControl.model
     property var contentModel
 
     property alias model: pLBannerSources.model
@@ -94,8 +94,8 @@ Utils.NavigableFocusScope {
                         when: history.nextEmpty && history.previousEmpty
                         PropertyChanges {
                             target: buttonView
-                            KeyNavigation.left: searchBox
-                            KeyNavigation.down: searchBox
+                            KeyNavigation.left: menu_selector
+                            KeyNavigation.down: menu_selector
                         }
                     },
                     State {
@@ -309,12 +309,12 @@ Utils.NavigableFocusScope {
                     Layout.preferredHeight: VLCStyle.icon_normal
                     contentModel: root.contentModel
 
-                    KeyNavigation.right: sort_control
+                    KeyNavigation.right: sortControl
                     KeyNavigation.up: buttonView
                 }
 
                 Utils.SortControl {
-                    id: sort_control
+                    id: sortControl
 
                     textRole: "text"
                     listWidth: VLCStyle.widthSortBox
@@ -371,6 +371,34 @@ Utils.NavigableFocusScope {
                         }
                     }
                 }
+
+                // Content model states
+                states: [
+                    State {
+                        name: "contentModel"
+                        when: root.contentModel !== undefined
+                        PropertyChanges {
+                            target: searchBox
+                            visible: true
+                        }
+                        PropertyChanges {
+                            target: sortControl
+                            visible: true
+                        }
+                    },
+                    State {
+                        name: "noContentModel"
+                        when: root.contentModel === undefined
+                        PropertyChanges {
+                            target: searchBox
+                            visible: false
+                        }
+                        PropertyChanges {
+                            target: sortControl
+                            visible: false
+                        }
+                    }
+                ]
             }
         }
     }
-- 
2.20.1



More information about the vlc-devel mailing list