0

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();

It's work on Linux and Android but on Windows I have this error:

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

How to fix it? Qt 5.7.0 (msvc 2015 compiler)

Alexey Savchuk
  • 1,068
  • 6
  • 13
  • 26

1 Answers1

0

Solution:

Don't use windeployqt.

Install Qt 5.7 for Windows. Use Process Explorer and manual copy dependencies.

Alexey Savchuk
  • 1,068
  • 6
  • 13
  • 26
  • You should use `qmldir` flag to successfully deploy with `windeployqt`. Passing in the directory of the QML files ensures that all dependencies are taken account. – BaCaRoZzo Nov 15 '16 at 15:38
  • I use this flag for deploy needed QML files. But windeployqt copies the wrong library (I do not know exactly what goes wrong). – Alexey Savchuk Nov 15 '16 at 16:03
  • Never deployed the MS version so I cannot say for sure but you should file a bugreport probably. – BaCaRoZzo Nov 15 '16 at 16:09