]> rtime.felk.cvut.cz Git - coffee/mtbrowser.git/commitdiff
better search
authorJiří Matěják <jiri.matejak@fel.cvut.cz>
Fri, 27 Apr 2018 16:12:08 +0000 (18:12 +0200)
committerJiří Matěják <jiri.matejak@fel.cvut.cz>
Fri, 27 Apr 2018 16:12:08 +0000 (18:12 +0200)
main.qml

index bf89577b28bf28decc53d051ab0c2115c6613176..90e9d69665d62e006a21149866810e79837f5b74 100644 (file)
--- a/main.qml
+++ b/main.qml
@@ -80,13 +80,17 @@ Window {
             }
 
             TextField {
+                function search() {
+                    if (length > 0) {
+                        webView.url = "https://www.google.com/search?ie=UTF-8&q=" + text
+                        clear()
+                    }
+                }
+
                 id: urlText
                 Layout.fillWidth: true
                 selectByMouse: true
-                onEditingFinished: {
-                    webView.url = "https://www.google.com/search?ie=UTF-8&q=" + urlText.text
-                    clear()
-                }
+                onEditingFinished: search()
             }
 
             ToolButton {