Skip to content Skip to sidebar Skip to footer

How To Use Qml - Qwebview In Android

I want to deploy one YouTube application in Android. But it only works on my computer, and it does not work on Android. It does not load any video. The problem is only with the QWe

Solution 1:

Referring to Qt Documentations:

Qt WebEngine is not available on mobile platforms

While

Qt WebView is actually useful for mobile platforms! .. as stated by Qt Here

You can use QwebView with Android , This should be possible with Qt5.x, as follow:

Configure project for Android kit and add QT += webview to your .pro file.

In main.cpp, it's important to callQtWebView::initialize() right after creating the QGuiApplication:

#include<QtWebView>QGuiApplication app(argc, argv);
QtWebView::initialize();

Now ready to use at qml side:

import QtWebView 1.1

WebView {
        id: webView
        anchors.fill: parent
        url: "http://some/url/"
        onLoadingChanged: {
            if (loadRequest.errorString)
                console.error(loadRequest.errorString);
        }
    }

Check Qt MiniBrowser Exmaple for QwebView with Android.

Solution 2:

if you are using Qt5. You should use WebEngineView, QWebView will not work on android.

importQtQuick2.0importQtWebEngine1.4Item{id:rootheight:500width:500Rectangle{anchors.fill:parentcolor:"black"WebEngineView{id :webEnginViewanchors.fill:parenturl :https://www.google.com}}}

Post a Comment for "How To Use Qml - Qwebview In Android"