]> rtime.felk.cvut.cz Git - coffee/mtbrowser.git/blobdiff - main.qml
google search and done
[coffee/mtbrowser.git] / main.qml
index 24091042f3a91cf7cabf39820636b57d6209a29b..bf89577b28bf28decc53d051ab0c2115c6613176 100644 (file)
--- a/main.qml
+++ b/main.qml
@@ -52,12 +52,10 @@ import QtQuick 2.0
 import QtQuick.Window 2.0
 import QtWebEngine 1.0
 import QtQuick.VirtualKeyboard 2.1
-import QtQuick.Controls 2.3
+import QtQuick.Controls 2.2
 import QtQuick.Layouts 1.3
 
 Window {
-    width: 1920
-    height: 1200
     visible: true
 
     ToolBar {
@@ -67,43 +65,52 @@ Window {
         anchors.right: parent.right
 
         RowLayout {
+            anchors.fill: parent
 
             ToolButton {
-                text: qsTr("<")
+                text: qsTr("")
                 onClicked: webView.goBack()
-                anchors.left: parent.left
+                enabled: webView.canGoBack
             }
 
             ToolButton {
-                text: qsTr(">")
+                text: qsTr("")
                 onClicked: webView.goForward()
+                enabled: webView.canGoForward
             }
 
             TextField {
                 id: urlText
-                text: ""
+                Layout.fillWidth: true
+                selectByMouse: true
+                onEditingFinished: {
+                    webView.url = "https://www.google.com/search?ie=UTF-8&q=" + urlText.text
+                    clear()
+                }
             }
 
             ToolButton {
-                text: qsTr("Reload")
+                id: reload
+                text: qsTr("↻")
                 onClicked: webView.reload()
             }
 
             ToolButton {
-                text: qsTr("Enter")
-                onClicked: webView.url = urlText.text
+                id: stop
+                text: qsTr("×")
+                onClicked: webView.url = "http://localhost/"
             }
         }
     }
 
     WebEngineView {
         id: webView
-        url: "https://google.cz/"
+        url: "http://localhost/"
         anchors.left: parent.left
         anchors.top: toolBar.bottom
         anchors.right: parent.right
         anchors.bottom: inputPanel.top
-        onUrlChanged: urlText.text = webView.url
+        //onUrlChanged: urlText.text = webView.url
     }
 
     InputPanel {
@@ -113,4 +120,3 @@ Window {
         anchors.right: parent.right
     }
 }
-