【发布时间】: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