【问题标题】:QWebChannel: crash on construction when running outside of QtCreatorQWebChannel:在 QtCreator 之外运行时构造崩溃
【发布时间】:2020-02-19 09:39:52
【问题描述】:

当我尝试在 QtCreator 外部 运行我的程序时,当调用 new QWebChannel(this) 时,代码会崩溃。我已经检查了 DLL 依赖项,但找不到在 IDE 内部和外部运行它的区别。

MyView::MyView() : ui(new Ui::MyView) {
    ui->setupUi(this);
    view = new QWebEngineView(this);

    channel = new QWebChannel(this); // crash at this line

    ui->content->addWidget(view);
    connect(view, &QWebEngineView::loadFinished, this, &MyView::finishLoading);
    view->page()->setWebChannel(channel);
    channel->registerObject("controller", this);
    view->load(QUrl("qrc:///res/index.html"));
}

在项目文件中我添加了QT += webengine webenginewidgets webchannel。还有其他我可能忘记的依赖项吗?

【问题讨论】:

    标签: qtwebengine qt5.7 qtwebchannel


    【解决方案1】:

    运行windeployqt.exe 会复制所有必要的依赖项(请参阅https://doc.qt.io/qt-5/windows-deployment.html)。像其他一些资源一样的接缝会导致崩溃。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-28
      • 1970-01-01
      • 1970-01-01
      • 2016-05-26
      • 1970-01-01
      • 2012-10-04
      • 2021-11-27
      • 2021-07-06
      相关资源
      最近更新 更多