summaryrefslogtreecommitdiffstats
path: root/examples/qtquick/quickwindow.qml
blob: afaff7c8d95a58cfaccc32adf00675891683676b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import QtQuick 2.0
import QtWebEngine 1.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0

ApplicationWindow {
    id: browserWindow
    height: 600
    width: 800
    visible: true
    title: webContentsView.title

    toolBar: ToolBar {
        id: navigationBar
        RowLayout {
            anchors.fill: parent

            ToolButton {
                id: backButton
                iconName: "go-previous"
                iconSource: ":/icons/go-previous.png"
                onClicked: webContentsView.goBack()
                enabled: webContentsView.canGoBack
            }
            ToolButton {
                id: forwardButton
                iconName: "go-next"
                iconSource: ":/icons/go-next.png"
                onClicked: webContentsView.goForward()
                enabled: webContentsView.canGoForward
            }
            ToolButton {
                id: reloadButton
                iconName: webContentsView.loading ? "process-stop" : "view-refresh"
                iconSource: webContentsView.loading ? ":/icons/process-stop.png" : ":/icons/view-refresh.png"
                onClicked: webContentsView.reload()
            }
            TextField {
                id: addressBar
                focus: true
                Layout.fillWidth: true

                onAccepted: webContentsView.url = utils.fromUserInput(text)
            }
        }
    }

    WebContentsView {
        id: webContentsView
        focus: true
        anchors.fill: parent
        url: utils.initialUrl()

        onUrlChanged: addressBar.text = url
    }
}