当我尝试在 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
中。还有其他我可能忘记的依赖项吗?