webview that displays a local html file?

4315
2
Jump to solution
06-12-2017 04:08 AM
by Anonymous User
Not applicable

Hi all, I wonder if anyone could point me in the right direction...

I can successfully create a WebView object, and get it to load a url from the www. But the documentation specifically says: Note: The WebView does not support loading content through the Qt Resource system.

WebView QML Type | Qt WebView 5.9 

I am wanting to compose, view, load, edit and save an html file locally, but this suggests to me I can't do it using the WebView object.

I can read the html file as text, and load it with the loadHtml() method, but it looks like the 'baseUrl' it expects is an online resource, and I can't get it to display any resources (such as image files).

How can I interact with a local html file?

import QtWebView 1.1
App {
    id: app
    width: 500; height: 500
     WebView{
        id: mywebview
        anchors.fill: parent
    }
}

0 Kudos
1 Solution

Accepted Solutions
SathyaPrasad
Esri Contributor

Check the Quick Report template. It supports loading of the webpage for help both local and remote.

Here is the location of the code that deals with loading local HTML files: 

QuickReport/controls/WebPage.qml

View solution in original post

2 Replies
SathyaPrasad
Esri Contributor

Check the Quick Report template. It supports loading of the webpage for help both local and remote.

Here is the location of the code that deals with loading local HTML files: 

QuickReport/controls/WebPage.qml

by Anonymous User
Not applicable

Thanks for that Sathya!

I see that it appears to be a custom arcgis webview and not the standard Qt one, so I'm assuming that someone at your end went through the same journey I did and ended up writing a custom one because the default one didn't do what you wanted!  

I haven't tested yet in an app but it certainly looks like what I'm looking for. Will post more here if I run into any issues.

(For others: this is the import statement used in that file)

import ArcGIS.AppFramework.WebView 1.0


cheers,

-Paul

0 Kudos