QML WebView - page interaction?

  • I have a QML based UI that has a "QtWebView 1.0" WebView component on it.

    What is the best way to interact with a page loaded from a web server (not a local resource)?

    Is there some way to, for example, insert a JavaScript object into the loaded page?
    Can I get signaled somehow on a page 'postMessage' call?

    From looking at the Qt 5.5 documentation it seems to indicate that the QML object WebView is only good viewing HTML content, not actually doing anything with it; however, Qt seems to have 'under the hood' mechanisms for getting things done such as invoking method through a metaobject.

    How can I pass a piece of information from the web page through to C++?


  • Is this what QtWebChannel is for? I'm finding it really difficult to figure out what bits and pieces of which Qt web components works in which fashions on which platforms.

    Basically I need to be able to pass a string from a webpage loaded from a remote server into my Qt C++ application on Windows/OSX/Linux/iOS/Android. I would like to use QML so that my UI can look the same on each platform.

    The string is going to be a SAML assertion returned by the user's interaction inside the web page.

    Currently on iOS I use QtWebView 1.1, and elsewhere I used QtWebKit 3.0

    I'm hoping that the 5.6 release (was that supposed to be two days ago?) will unify this, but at this point I'm just hoping I can do something this simple through QML on each platform.

Log in to reply