【问题标题】:QML WebView component is not readyQML WebView 组件未准备好
【发布时间】:2016-11-14 08:03:05
【问题描述】:

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

【问题讨论】:

    标签: c++ windows qt qml qt5.7


    【解决方案1】:

    解决方案:

    不要使用windeployqt。

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

    【讨论】:

    • 您应该使用qmldir 标志来成功部署windeployqt。传入 QML 文件的目录可确保考虑所有依赖项。
    • 我使用这个标志来部署所需的 QML 文件。但是 windeployqt 复制了错误的库(我不知道到底出了什么问题)。
    • 从未部署过 MS 版本,所以我不能肯定,但您可能应该提交错误报告。
    猜你喜欢
    • 2017-02-22
    • 1970-01-01
    • 1970-01-01
    • 2021-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-05
    • 1970-01-01
    相关资源
    最近更新 更多