]> rtime.felk.cvut.cz Git - coffee/mtbrowser.git/blobdiff - main.qml
no uppercase
[coffee/mtbrowser.git] / main.qml
index 8d16ec0b1375efe74c8a05072e1300dc2e88f975..c07e693b0c1d1e6fa1428382bb55c7371087a126 100644 (file)
--- a/main.qml
+++ b/main.qml
@@ -52,19 +52,70 @@ import QtQuick 2.0
 import QtQuick.Window 2.0
 import QtWebEngine 1.0
 import QtQuick.VirtualKeyboard 2.1
+import QtQuick.Controls 2.2
+import QtQuick.Layouts 1.3
 
 Window {
-    width: 1920
-    height: 1200
     visible: true
 
-    WebEngineView {
-        id: appContainer
-        url: "http://google.cz/"
+    ToolBar {
+        id: toolBar
         anchors.left: parent.left
         anchors.top: parent.top
         anchors.right: parent.right
+
+        RowLayout {
+            anchors.fill: parent
+
+            ToolButton {
+                text: qsTr("←")
+                onClicked: webView.goBack()
+                enabled: webView.canGoBack
+            }
+
+            ToolButton {
+                text: qsTr("→")
+                onClicked: webView.goForward()
+                enabled: webView.canGoForward
+            }
+
+            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: search()
+                inputMethodHints: Qt.ImhNoAutoUppercase
+            }
+
+            ToolButton {
+                id: reload
+                text: qsTr("↻")
+                onClicked: webView.reload()
+            }
+
+            ToolButton {
+                id: stop
+                text: qsTr("×")
+                onClicked: webView.url = "http://localhost/"
+            }
+        }
+    }
+
+    WebEngineView {
+        id: webView
+        url: "http://localhost/"
+        anchors.left: parent.left
+        anchors.top: toolBar.bottom
+        anchors.right: parent.right
         anchors.bottom: inputPanel.top
+        //onUrlChanged: urlText.text = webView.url
     }
 
     InputPanel {