[vlc-devel] [PATCH 1/5] qml: make the search box field mouse selectable

Pierre Lamot pierre at videolabs.io
Thu Jun 13 18:44:11 CEST 2019


---
 modules/gui/qt/qml/utils/SearchBox.qml | 93 +++++++++++++-------------
 1 file changed, 48 insertions(+), 45 deletions(-)

diff --git a/modules/gui/qt/qml/utils/SearchBox.qml b/modules/gui/qt/qml/utils/SearchBox.qml
index d3b5dff03c..0871cc9bf6 100644
--- a/modules/gui/qt/qml/utils/SearchBox.qml
+++ b/modules/gui/qt/qml/utils/SearchBox.qml
@@ -71,54 +71,10 @@ Utils.NavigableFocusScope {
         to: 0
     }
 
-    Row {
-        id: content
-
-        Utils.IconToolButton {
-            id: icon
-
-            size: VLCStyle.icon_normal
-            text: VLCIcons.topbar_filter
-
-            onClicked: {
-                if (searchBox.text == "")
-                    expanded = !expanded
-            }
-        }
-
-        TextField {
-            id: searchBox
-
-            anchors.verticalCenter: parent.verticalCenter
-
-            font.pixelSize: VLCStyle.fontSize_normal
-
-            color: VLCStyle.colors.buttonText
-            width: 0
-
-            background: Rectangle {
-                color: VLCStyle.colors.button
-                border.color: {
-                    if ( searchBox.text.length < 3 && searchBox.text.length !== 0 )
-                        return VLCStyle.colors.alert
-                    else if ( searchBox.activeFocus )
-                        return VLCStyle.colors.accent
-                    else
-                        return VLCStyle.colors.buttonBorder
-               }
-            }
-
-            onTextChanged: {
-                if (contentModel !== undefined)
-                    contentModel.searchPattern = text;
-            }
-        }
-    }
-
     MouseArea {
         id: mouseArea
         hoverEnabled: true
-        anchors.fill: content
+        anchors.fill: parent
 
         onClicked: {
             searchBox.forceActiveFocus()
@@ -132,5 +88,52 @@ Utils.NavigableFocusScope {
             if (searchBox.text == "")
                 expanded = false
         }
+
+
+        Row {
+            id: content
+
+            Utils.IconToolButton {
+                id: icon
+
+                size: VLCStyle.icon_normal
+                text: VLCIcons.topbar_filter
+
+                onClicked: {
+                    if (searchBox.text == "")
+                        expanded = !expanded
+                }
+            }
+
+            TextField {
+                id: searchBox
+
+                anchors.verticalCenter: parent.verticalCenter
+
+                font.pixelSize: VLCStyle.fontSize_normal
+
+                color: VLCStyle.colors.buttonText
+                width: 0
+
+                selectByMouse: true
+
+                background: Rectangle {
+                    color: VLCStyle.colors.button
+                    border.color: {
+                        if ( searchBox.text.length < 3 && searchBox.text.length !== 0 )
+                            return VLCStyle.colors.alert
+                        else if ( searchBox.activeFocus )
+                            return VLCStyle.colors.accent
+                        else
+                            return VLCStyle.colors.buttonBorder
+                    }
+                }
+
+                onTextChanged: {
+                    if (contentModel !== undefined)
+                        contentModel.searchPattern = text;
+                }
+            }
+        }
     }
 }
-- 
2.17.1



More information about the vlc-devel mailing list