Important: Please read the Qt Code of Conduct -

Changing HTML in QtWebView

  • Hi,

    I'm currently trying to build an interactive book using Qt. To achieve that, I want to display rendered HTML with keywords. If the user clicks on a keyword, a menu shows up displaying various ways to interact with said keyword.

    Depending on what you choose the story will change so it is crucial that the displayed text also changes.

    Since I'm using HTML and want the app to be multi platform, my only option to render HTML is QtWebView. This is where the trouble starts.

    I can import QtWebView 1.1 in my QML file, but the WebView never appears in the QML Types section. If I put it in by editing the QML file textually, I get a functional browser but the Designer claims Item could not be created when hovering over it in the navigator. There's also an exclamation mark next to the WebView and next to the root object, when hovering over the one next to the root object, Qt claims that module "QtWebView" is not installed. However, this is not the case. QtWebView exists both in my GCC- and in my ARM7 installation of Qt.

    Even though it's ugly and not really intuitive, I could live with that if the rest was working. However, I can't access the methods for QtWebView in my C++ code. When I try to #include <QtWebView> it claims that there is no such file or directory. Thus I can't even call loadHtml().

    I already thought of putting HTML into seperate files and editing those using fopen() , but android doesn't allow you to change assets after the APK has been created.

    I've been reading the docs over and over again but can't seem to come up with a solution. Any help would be really awesome.

    Thanks in advance!