QML WebView 组件未就绪

QML WebView component is not ready

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 编译器)

解决方案:

不要使用 windeployqt。

为 Windows 安装 Qt 5.7。 使用 Process Explorer 和手动复制依赖项。