我在使用 QWebEngineView 时遇到了一些麻烦。在这个程序中,我想使用 QWebEngineView 从网站获取 cookie 并发布请求。但是,我无法为我的 QwebEngineView 设置 url。控制台输出信息如下:
Surface Type: OpenGL
Surface Profile: CompatibilityProfile
Surface Version: 4.6
Using Default SG Backend: yes
Using Software Dynamic GL: no
Using Angle: no
Init Parameters:
* application-name Translator
* browser-subprocess-path C:\Qt\6.2.0\msvc2019_64\bin\QtWebEngineProcessd.exe
* create-default-gl-context
* disable-direct-composition
* disable-es3-gl-context
* disable-features DnsOverHttpsUpgrade,ConsolidatedMovementXY,InstalledApp,BackgroundFetch,WebOTP,WebPayments,WebUSB,PictureInPicture
* disable-speech-api
* enable-features TracingServiceInProcess
* enable-threaded-compositing
* gpu-preferences SAAAAAAAAADoAAAQAAAAAAAAAAAAAAAAAABgAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AAAAAAAAAHgAAAAAAAAAKAAAAAQAAAAgAAAAAAAAACgAAAAAAAAAMAAAAAAAAAA4AAAAAAAAABAAAAAAAAAAAAAAAAUAAAAQAAAAAAAAAAAAAAAGAAAAEAAAAAAAAAABAAAABQAAABAAAAAAAAAAAQAAAAYAAAAIAAAAAAAAAAgAAAAAAAAA
* in-process-gpu
* use-gl desktop
ASSERT failure in void __cdecl QtFontFamily::ensurePopulated(void): "??????????", file \Users\qt\work\qt\qtbase\src\gui\text\qfontdatabase.cpp, line 294
我不明白什么是?????????意思是。此外,我找不到它提到的 cpp 文件。这是我的代码的一部分:
void NetCore::run()
{
...
viewer=new QWebEngineView;
viewer.setUrl(QUrl("nmt.youdao.com"));//viewer.url(QUrl("nmt.youdao.com"))meets the same problem
...
}
虽然NetCore 类是从QObject继承的,但run()是一个公共函数。只要我把“setUrl”这句删掉,就可以运行函数了。我将 Qt6.2.0 与 vs2019 一起使用。如果您需要更多详细信息,请告诉我