go-qml / qml

QML support for the Go language
Other
1.96k stars 187 forks source link

Using Qt 5.4 using the new chromium web engine (WebEngineView) causes crash #141

Open obscuren opened 9 years ago

obscuren commented 9 years ago

The QtWebEngine need to be initialised prior to creating new instances of WebEngineView.

#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
#include <qtwebengineglobal.h>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    QtWebEngine::initialize(); // <= FIX
}

You'll also need to modify bridge.go and add Qt5WebEngine to pkg-config (https://github.com/go-qml/qml/blob/v1/bridge.go#L6): // #cgo pkg-config: Qt5Core Qt5Widgets Qt5Quick Qt5WebEngine.

I'm not sure how to properly fix this because

  1. WebEngine is only available in Qt 5.4 (I think)
  2. You don't always need the WebEngine initialised for non-webbased applications.

I'm happy to fix this and send a PR though I'll need a little direction on how to properly approach this (mostly because it locks go-qml to version 5.4).

mickgardner commented 9 years ago

+1 This is a fairly important feature that needs implementing as WebEngine is a far improved web browser than WebView.

hachi8833 commented 8 years ago

+1