Qt World Summit: Submit your Presentation

Advice about webview/engine on multi-platform

  • Despite clearly selecting QtWebView 1.1 as an install option, qmake claims (on OSX) that webview is an unknown module (this *.pro file works fine on Windows.)

    So, I tried the nanobrowser sample - which builds fine on OSX, but qmake for iOS claims that webengine is an unknown module...

    If I need to, in QML, display a web page on Windows, Linux, OSX, Android, and iOS - am I supposed to be mixing/matching multiple Qt technologies?

    I can't discern from the documentation what works on which platform...

    Linux and Windows - webview works great for me.
    Android I haven't tried as I'm trying to get past iOS (usually the sticking point in my experience with any technology.)
    OSX - Apparently webengine can work (no idea why webview doesn't.)

    Any pointers on how to embed web via QML on iOS would be appreciated - thanks!

  • I am viewing some videos online from the 2015 Qt World Summit and they suggest that QtWebView is supposed to work on all of these platforms... The speaker also mentions that you must set a special flag when building for OSX to have web view available - I installed from the official 5.5 installer DMG on OSX and WebView was selected as an extra - so I'm unsure why it doesn't seem to resolve when I add it to a Qt Creator sample project *.pro file and then run qmake on it...

    I am also confused as to why qmake doesn't know what it is when I try to build using the iOS simulator kit... Same problem, acts as though it has no idea what webview is...

    Weirdly, I get QML's WebView if I add webkit to the *.pro on the OSX machine, and import webkit 3.0 in the QML file.

    This doesn't work on Windows though - although I think on Windows I'm using 5.6 of Qt (because I'm running VS 2015) - is web stuff getting re-organized between the two versions?

    Anyhow - the iOS Simulator build kit selection still fails with webkit on 5.5 when I run qmake against the PRO that works fine for OSX now.

  • Lifetime Qt Champion


    What you need for iOS and Android is the QtWebView module. There's no QtWebKit not QtWebEngine available for them because of platform owner (Apple, Google) restrictions. So be sure to add QT += webview to your .pro file for these platforms.

  • Thanks :)

    I realized this, this afternoon - basically:

    //import QtWebView 1.1
    import QtWebKit 3.0

    For OSX, and for iOS

    import QtWebView 1.1
    //import QtWebKit 3.0

    I haven't figured out how to import based upon build kit, but I presume the worst case scenario would be to have multiple QML files (one for each platform that requires different imports.) No?

  • Lifetime Qt Champion

    You can follow the structure proposed in QQmlFileSelector

  • Cool, thx :)

Log in to reply