[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: clear SearchBox text field in default state

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Fri Aug 4 20:02:30 UTC 2023



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


Commits:
2147a23d by Fatih Uzunoglu at 2023-08-04T19:43:14+00:00
qml: clear SearchBox text field in default state

- - - - -
a3f4b9d4 by Fatih Uzunoglu at 2023-08-04T19:43:14+00:00
qml: use `checked` instead of `highlighted` in SearchBox button

- - - - -
dd62e3a2 by Fatih Uzunoglu at 2023-08-04T19:43:14+00:00
qml: set focus reason in SearchBox cancel action

- - - - -


1 changed file:

- modules/gui/qt/widgets/qml/SearchBox.qml


Changes:

=====================================
modules/gui/qt/widgets/qml/SearchBox.qml
=====================================
@@ -42,34 +42,46 @@ FocusScope {
             _widthOverridden = true
     }
 
-    states: State {
-        name: "expanded"
+    states: [
+        State {
+            name: "expanded"
 
-        PropertyChanges {
-            target: textField
+            PropertyChanges {
+                target: textField
 
-            focus: true
-            // Take care if SearchBox was set a specific width:
-            width: (root._widthOverridden ? (content.width - iconButton.width) : textField.implicitWidth)
-        }
+                focus: true
+                // Take care if SearchBox was set a specific width:
+                width: (root._widthOverridden ? (content.width - iconButton.width) : textField.implicitWidth)
+            }
 
-        PropertyChanges {
-            target: iconButton
+            PropertyChanges {
+                target: iconButton
+                checked: true
+            }
+        },
+        State {
+            name: ""
+
+            PropertyChanges {
+                target: textField
+                text: ""
+            }
 
-            highlighted: true
+            PropertyChanges {
+                target: iconButton
+                focus: true
+                checked: false
+            }
         }
-    }
+    ]
 
     transitions: Transition {
         from: ""; to: "expanded"
         reversible: true
 
-        SequentialAnimation {
-            NumberAnimation { property: "width"; easing.type: Easing.InOutSine; duration: VLCStyle.duration_long; }
-            PropertyAction { property: "highlighted" }
-            PropertyAction { property: "focus" }
-        }
+        NumberAnimation { property: "width"; easing.type: Easing.InOutSine; duration: VLCStyle.duration_long; }
     }
+
     readonly property ColorContext colorContext: ColorContext {
         id: theme
     }
@@ -91,13 +103,12 @@ FocusScope {
             iconText: VLCIcons.search
             text: I18n.qtr("Filter")
 
-            focus: root.state === ""
+            focus: true
 
             Navigation.parentItem: root
             Navigation.leftItem: textField
 
             onClicked: {
-                textField.clear()
                 root.state = (root.state === "") ? "expanded" : ""
             }
         }
@@ -125,7 +136,7 @@ FocusScope {
 
             Navigation.parentItem: root
             Navigation.rightItem: clearButton.visible ? clearButton : iconButton
-            Navigation.cancelAction: function() { root.state = "" }
+            Navigation.cancelAction: function() { root.state = ""; iconButton.focusReason = Qt.ShortcutFocusReason }
 
             Accessible.searchEdit: true
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/041a1f37f89cd89c2d2ff373febb9866943d42f6...dd62e3a2f0651a031ef2fe40e332636c5535531a

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


VideoLAN code repository instance


More information about the vlc-commits mailing list