blob: bd6504d6bdb43041891412bb051eaf1ae23abd86 (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
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
toolBar: ToolBar {
id: navigationBar
RowLayout {
anchors.fill: parent
ToolButton {
id: backButton
iconName: "go-previous"
iconSource: ":/icons/go-previous.png"
onClicked: webContentsView.goBack()
}
ToolButton {
id: forwardButton
iconName: "go-next"
iconSource: ":/icons/go-next.png"
onClicked: webContentsView.goForward()
}
ToolButton {
id: reloadButton
iconName: "view-refresh"
iconSource: ":/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: "http://qt-project.org/"
Binding {
target: webContentsView.children[0]
property: 'anchors.fill'
value: webContentsView
when: webContentsView.children.length > 0
}
onUrlChanged: addressBar.text = url
}
Text {
id: info
anchors.top: parent.top
anchors.right: parent.right
horizontalAlignment: "AlignRight"
width: 100
height: 100
text: viewContainer.children[0].width + "x" + viewContainer.children[0].height
}
}
|