QWebPage on Android
Thank you for your suggestion but, please note, I need same feature of QWebPage. The main difference with WebView component is that QWebPage is not showed on the screen but work in background and return repaint event for inform that something is changed in the current web page and need to be redraw. Native android webview have similar feature using onDraw() event but the main problem is the onDraw() event is emitted only if the current webview control is showed on the screen. If this is hidden in backround as I need the draw event will not emitted...
may I know what do you want to achieve with onDraw()?
did your content of webview is dynamic or static?
I'm able to create an apps that fetch json data from web server using QNetworkAccessManager, and show it on the webview.
I keep the string value, and when webview is shown, I can change the content with that value.
I had to do it that way, because my web content contains more than one animated gif images.
The only way to make them animated is only with webview.
I need to use webkit to manage some online maps. The problem of this web page was the code of the page is quicky loaded but, since there are a lot of images composing the map, not all the images are loaded instantly. I need to know exacly when all the images are loaded before get screenshot. Using QWebPage component is very easy since there is the "repaintrequest" event that inform me every time there is a change in the web viewport. Unfortunately QWebPage is not available in android. Same result can be reached using onDraw() from native webview component but in my application the viewport managing the web page must be hidden and in android (like Windows too) when a component is in invisible state no draw event is emitted since there is no need of it.
It's similar to what happened to me.
What I did was I fetch the content using QNetworkManager, find the img tag using regex, download all images from its src attribute using QNetworkManager again and save them to sdcard.
when all images downloaded, you can "refresh" webview by change its data.
@m_webView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);@
where baseUrl is your path to all images you saved.
but I didn't know will it worked on map.
And also, I think you don't need to hide by using visibility, you can just move it to somewhere not visible on screen.
Maybe something like this.
y: height: Screen.height
x: width: Screen.width
also not tested yet.
I didn't try to move the view out of the screen but I don't think will work as you can see from the documentation following:
It's the normal behaviours of any OS, if the window is not visible stop to redraw for avoid unnecessary CPU work.
I think you need to try anything possible if you really want to port your app to android.
I've just tested it with google maps using QtWebview. When I hide the webview (move the view out of the screen), I also change its url to some city.
I got output from QtCreator Application Output tab something like this.
And when I show the webview, the maps already loaded to the city on the url.
But I don't know if this is similar to what you want to do since I do not know what your app is.
In your test you basically tried if the "web engine" is able to work if the view is out of the screen and I expect it to work since the thread is active. The problem is you don't have "updates" regarding he current status of the map screen image painted. This is what I miss and I need for my app...
Anyway thank you for your time :)