[Interest] [QML] using unity3d application within WebView (not working) and QWebView (working)

Christoph Petzold christoph.petzold at hasomed.de
Thu Nov 20 11:18:20 CET 2014


Hi,

i have two minimal examples for loading a unity3d application into a qt-application. The first example uses the QWebView class to load the url which loads the unity app code. 

// start of QWebView example
#include <QApplication>
#include <QWebView>
#include <QWebFrame>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QWebView *webView = new QWebView();
    webView->setGeometry(50,50,1024,768);

    QWebSettings *webSettings = webView->page()->settings();
    webSettings->setAttribute(QWebSettings::PluginsEnabled, true);
    webView->show();
    webView->setUrl(QUrl("http://chromianwars.com/demo"));

    return a.exec();
}
// end of QWebView example

This works quite well. The second example trys to do the same but with QML WebView but it does not work.

// start of QML WebViewExample
import QtQuick 2.3
import QtQuick.Controls 1.0
//import QtWebKit 3.0
import QtWebKit.experimental 1.0

ApplicationWindow {
    visible: true
    width: 1600
    height: 1000
    title: qsTr("WebView example")

    Rectangle {

       width: 960
       height: 600

       WebView{
           anchors.fill: parent
           experimental.preferences.pluginsEnabled: true
           url: "http://chromianwars.com/demo"
           //url: "http://www.google.de"
       } // webview
    } // rectanlge
}
// end of QML WebViewExample

As you can see in the QML WebView example i use import "QtWebKit.experimental 1.0" and within the WebView i use "experimental.preferences.pluginsEnabled: true". May be this is unsupported. 
See also: http://rschroll.github.io/beru/2013/08/21/qtwebview.experimental.html

My questions are:
- Is there a chance to get the WebView to load the unity app like the QWebView does?
- Where do i find some information about QtWebKit.experimental?
- Should i use the QWebView instead of the WebView for my purpose?
- Should i try to use activex to integrate the unity3d app into my QML app?
(I need the QML app to be able to talk to the unity3d app via the Qt WebKit Bridge (http://qt-project.org/doc/qt-5/qtwebkit-bridge.html)
(i am using Qt 5.3.2 MinGW 4.8.2 32 Bit)

Mit freundlichen Grüßen/ Best regards

Christoph Petzold
Mitarbeiter Abteilung Funktionelle Elektrostimulation



HASOMED GmbH
Paul-Ecke-Str. 1
39114 Magdeburg

Tel.: +49 391  62 30 112
Fax: +49 391  62 30 113
E Mail: christoph.petzold at hasomed.de
Web: www.hasomed.de

HRB 108418
UST IdNo DE 114 161 708
Steuernummer 102/111/09705
GF Dr. Peter Weber, Frank Schulze





More information about the Interest mailing list