QWebChannel:当 运行 在 QtCreator 之外时施工崩溃
QWebChannel: crash on construction when running outside of QtCreator
当我尝试 运行 我的程序 在 QtCreator 之外 时,调用 new QWebChannel(this)
时代码崩溃。我已经检查了 DLL 依赖项,但无法从 IDE 内部和外部找到 运行ning 它之间的区别。
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
。还有其他我可能忘记的依赖项吗?
运行 windeployqt.exe
复制所有必需的依赖项(参见 https://doc.qt.io/qt-5/windows-deployment.html)。似乎需要其他一些资源导致崩溃。
当我尝试 运行 我的程序 在 QtCreator 之外 时,调用 new QWebChannel(this)
时代码崩溃。我已经检查了 DLL 依赖项,但无法从 IDE 内部和外部找到 运行ning 它之间的区别。
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
。还有其他我可能忘记的依赖项吗?
运行 windeployqt.exe
复制所有必需的依赖项(参见 https://doc.qt.io/qt-5/windows-deployment.html)。似乎需要其他一些资源导致崩溃。