[vlc-commits] qml: make the search box field mouse selectable

Pierre Lamot git at videolan.org
Mon Jun 17 11:25:35 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Jun 13 18:44:11 2019 +0200| [abedcb610b9745a5d074b488b4623b83a6073e34] | committer: Jean-Baptiste Kempf

qml: make the search box field mouse selectable

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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;
+                }
+            }
+        }
     }
 }



More information about the vlc-commits mailing list