main.qml:
ApplicationWindow {
visible: true
visibility: "Maximized"
title: "My title"
WebView {
id: webView
objectName: "webView"
anchors.fill: parent
url: initialUrl
}
}
main.cpp:
QQmlApplicationEngine engine;
QQmlContext *context = engine.rootContext();
context->setContextProperty(QString("initialUrl"), "http://google.com/");
QQmlComponent component(&engine, QUrl("qrc:/qml/main.qml"));
qDebug() << component.status();
component.create();
Linux と Android では動作しますが、Windows では次のエラーが発生します。
warning: QQmlComponent::Status(Ready) // This "qDebug() << component.status();" from my code
warning: QQmlComponent: Component is not ready
warning: QObject::connect: invalid null parameter
warning: QObject::connect: invalid null parameter
warning: QObject::connect: invalid null parameter
warning: QObject::connect: invalid null parameter
Program received signal SIGSEGV, Segmentation fault.
0x6e9cd3dd in Qt5Quick!?setParentItem@QQuickItem@@QAEXPAV1@@Z () from C:\myprog-dist\Qt5Quick.dll
修正方法は?Qt 5.7.0 (msvc 2015 コンパイラ)