[Android-development] Compiling Qt WebView, sources?

Christian Strømme christian.stromme at theqtcompany.com
Tue Jan 6 14:25:01 CET 2015



On 06/01/15 13:16 , Harri Pasanen wrote:
> On 06/01/2015 10:38, Christian Strømme wrote:
>> The WebView in the
>> QtWebView module doesn't provide a loadHtml() method yet (should be
>> trivial to implement though
>> [https://bugreports.qt-project.org/browse/QTBUG-43661]).
> Thanks for working on this.
>
> In the meanwhile I made equally "trivial" workaround like:
>
>       QFile f(tr(":/res/help-en.htm"));
>       _helpFile =
> QStandardPaths::writableLocation(QStandardPaths::TempLocation)+"/help.htm";
>       f.copy(_helpFile);
>
> and then using the file:// url to get it.   Is this something like you
> had in mind, or is there some clever way to bypass the temp file?
>

Yes, that should do it and it's probably the most portable workaround.
Alternatively the webview should accept url to resource files, e.g., 
assets, but I don't see any benefits from going that route...

A quick/rough implementation of loadHtml() can be found here: 
https://codereview.qt-project.org/#/c/102970/

> Anyway, now I got it displaying the help. There seems to be something
> strange going on with the font size though.  I did not have any css
> styles changing the font size, and by default the Text rich text
> displayed a reasonable size.
> I added a css for the font size, and sometimes it is respected, but
> other times the font is still huge.   This is on Nexus 7.
>
> I'm not sure if this is related to file url, possibly triggering some
> race condition?
> I tried a couple of http urls and those seemed to render just fine.
>
>

Not sure about this one... We don't do anything special that should 
affect that, but please make a bug report with an example if you can.

>
> Harri
>
>
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development
>



More information about the Android-development mailing list