diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-14 22:20:29 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-14 22:20:29 +0100 |
commit | 5360a79b9843abaaab2b3628fd0466841a8498b1 (patch) | |
tree | 6f2ceb8314d0acd827894ebb7b5108f8f10247d7 /components/mailviewer/qml/HtmlContent.qml | |
parent | f5fd6bee71f5a8dd5cbb18dc590d60027b1634f4 (diff) | |
download | kube-5360a79b9843abaaab2b3628fd0466841a8498b1.tar.gz kube-5360a79b9843abaaab2b3628fd0466841a8498b1.zip |
WebEngine only HtmlContent view
Diffstat (limited to 'components/mailviewer/qml/HtmlContent.qml')
-rw-r--r-- | components/mailviewer/qml/HtmlContent.qml | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/components/mailviewer/qml/HtmlContent.qml b/components/mailviewer/qml/HtmlContent.qml index 15bd1915..15cb1843 100644 --- a/components/mailviewer/qml/HtmlContent.qml +++ b/components/mailviewer/qml/HtmlContent.qml | |||
@@ -18,31 +18,37 @@ | |||
18 | 18 | ||
19 | import QtQuick 2.4 | 19 | import QtQuick 2.4 |
20 | import QtQuick.Controls 1.3 | 20 | import QtQuick.Controls 1.3 |
21 | import QtWebKit 3.0 | 21 | import QtWebEngine 1.3 |
22 | // import QtWebEngine 1.3 //This would give use contentsSize | ||
23 | import QtWebEngine 1.2 | ||
24 | 22 | ||
25 | Item { | 23 | Item { |
26 | id: root | 24 | id: root |
27 | property string content: model.content | 25 | property string content: model.content |
28 | property int contentHeight: helperView.contentHeight; | 26 | //We have to give it a minimum size so the html content starts to expand |
29 | //FIXME workaround until QtWebEngine 1.3 with contentsSize | 27 | property int contentHeight: 10; |
30 | 28 | ||
31 | height: contentHeight | 29 | height: contentHeight |
32 | width: partColumn.width | 30 | width: partColumn.width |
33 | 31 | ||
34 | WebView { | ||
35 | id: helperView | ||
36 | visible: false | ||
37 | Component.onCompleted: loadHtml(content, "file:///") | ||
38 | } | ||
39 | WebEngineView { | 32 | WebEngineView { |
40 | id: htmlView | 33 | id: htmlView |
41 | anchors.fill: parent | 34 | anchors.fill: parent |
42 | Component.onCompleted: loadHtml(content, "file:///") | 35 | Component.onCompleted: loadHtml(content, "file:///") |
36 | onContentsSizeChanged: { | ||
37 | root.contentHeight = contentsSize.height; | ||
38 | } | ||
39 | onLoadingChanged: { | ||
40 | if (loadRequest.status === WebEngineView.LoadFailedStatus) { | ||
41 | console.warn("Failed to load html content."); | ||
42 | console.warn("Error is ", loadRequest.errorString); | ||
43 | } | ||
44 | } | ||
45 | settings { | ||
46 | autoLoadImages: true; | ||
47 | javascriptEnabled: false; | ||
48 | localStorageEnabled: false; | ||
49 | } | ||
43 | } | 50 | } |
44 | onContentChanged: { | 51 | onContentChanged: { |
45 | htmlView.loadHtml(content, "file:///"); | 52 | htmlView.loadHtml(content, "file:///"); |
46 | helperView.loadHtml(content, "file:///"); | ||
47 | } | 53 | } |
48 | } | 54 | } |