summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/package/contents/ui/WebView.qml41
1 files changed, 11 insertions, 30 deletions
diff --git a/components/package/contents/ui/WebView.qml b/components/package/contents/ui/WebView.qml
index fe3a8bcd..01998911 100644
--- a/components/package/contents/ui/WebView.qml
+++ b/components/package/contents/ui/WebView.qml
@@ -2,49 +2,30 @@ import QtQuick 2.4
2import QtQuick.Controls 1.3 2import QtQuick.Controls 1.3
3import QtWebKit 3.0 3import QtWebKit 3.0
4// import QtWebEngine 1.3 //This would give use contentsSize 4// import QtWebEngine 1.3 //This would give use contentsSize
5// import QtWebEngine 1.2 5import QtWebEngine 1.2
6 6
7Item { 7Item {
8 id: root 8 id: root
9 property string content; 9 property string content;
10 // property int contentWidth: 500; 10 property int contentWidth: helperView.contentWidth;
11 // property int contentHeight: 500; 11 property int contentHeight: helperView.contentHeight;
12 property int contentWidth: htmlView.contentWidth; 12 //FIXME workaround until QtWebEngine 1.3 with contentsSize
13 property int contentHeight: htmlView.contentHeight;
14 // width: htmlView.width
15 // height: htmlView.height
16 WebView { 13 WebView {
14 id: helperView
15 visible: false
16 Component.onCompleted: loadHtml(content, "file:///")
17 }
18 WebEngineView {
17 id: htmlView 19 id: htmlView
18 anchors.top: parent.top 20 anchors.fill: parent
19 anchors.horizontalCenter: parent.horizontalCenter
20 width: contentWidth
21 height: contentHeight
22 onNavigationRequested: {
23 // detect URL scheme prefix, most likely an external link
24 var schemaRE = /^\w+:/;
25 if (schemaRE.test(request.url)) {
26 request.action = WebView.AcceptRequest;
27 } else {
28 request.action = WebView.IgnoreRequest;
29 // delegate request.url here
30 }
31 }
32 onLoadingChanged: { 21 onLoadingChanged: {
33 console.warn("Error is ", loadRequest.errorString); 22 console.warn("Error is ", loadRequest.errorString);
34 console.warn("Status is ", loadRequest.status); 23 console.warn("Status is ", loadRequest.status);
35 } 24 }
36 Component.onCompleted: loadHtml(content, "file:///") 25 Component.onCompleted: loadHtml(content, "file:///")
37 } 26 }
38 // WebEngineView {
39 // id: htmlView
40 // anchors.fill: parent
41 // onLoadingChanged: {
42 // console.warn("Error is ", loadRequest.errorString);
43 // console.warn("Status is ", loadRequest.status);
44 // }
45 // Component.onCompleted: loadHtml(content, "file:///")
46 // }
47 onContentChanged: { 27 onContentChanged: {
48 htmlView.loadHtml(content, "file:///"); 28 htmlView.loadHtml(content, "file:///");
29 helperView.loadHtml(content, "file:///");
49 } 30 }
50} 31}