我需要获取网页中的信息,所以使用了QWebChannel。
代码几乎是直接复制standalone这个例子的,除了用QWebEngineView::load代替了QDesktopServices::openUrl,在我的代码中使用QDesktopServices::openUrl也能正常工作。
我尝试谷歌了一下,有人说是QWebSocket的原因,建议用QWebEngineView::setHtml,但我使用了QWebEngineView::setHtml之后,只有错误信息改变,程序依然崩溃了。
请大家帮忙看一下,谢谢!
以下是使用QWebEngineView::load的错误信息:
[0918/212043:FATAL:origin.cc(16)] Check failed: origin[origin.size() - 1] != '/' (/ vs. /)
Backtrace:
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182F67BC6+47157270]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E1629D+45774573]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001825B1790+36973536]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001836B4A6D+54812349]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018370280C+55131228]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001837DB4C7+56019223]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001836FC95C+55106988]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001837CB0B0+55952640]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001837FC462+56154290]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000180D6C831+11525249]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000180D6FF53+11539363]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000180A180E7+8033591]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001808CA6EE+6667070]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001808CAF11+6669153]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018440E528+68811128]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018440E4A5+68810997]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001843F407A+68703434]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001843F2C62+68698290]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018440BB84+68800468]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018440B78D+68799453]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001843EC274+68671172]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182FA2908+47398232]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182FA2A34+47398532]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182FA0671+47389377]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182FA2180+47396304]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182FA20D5+47396133]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E333D3+45893667]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E7CDEB+46195259]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E33255+45893285]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182EAF1CD+46401053]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000180354256+939686]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001803557DC+945196]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182EAFE5F+46404271]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182ECD53D+46524813]
BaseThreadInitThunk [0x00007FFA45362D92+34]
RtlUserThreadStart [0x00007FFA466A9F64+52]
以下是使用QWebEngineView::setHtml的错误信息:
[0918/205031:FATAL:gl_bindings_autogen_gl.cc(5046)] Check failed: false. Trying to call glDeleteSync() without current GL context
Backtrace:
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182F67BC6+47157270]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E1629D+45774573]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000181A5CD5C+25092524]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000185BEC68B+93838043]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000185BEC79C+93838316]
CertificateErrorController::url [0x00000001801C2206+19142]
QtWebEngineCore::CustomUrlSchemeHandler::setScheme [0x00000001801E7793+38067]
QtWebEngineCore::CustomUrlSchemeHandler::setScheme [0x00000001801E2C33+18771]
QtWebEngineCore::CustomUrlSchemeHandler::setScheme [0x00000001801E2B31+18513]
QtWebEngineCore::CustomUrlSchemeHandler::setScheme [0x00000001801E2BD6+18678]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001802EECBD+524557]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182F9BC12+47370338]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E33682+45894354]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E30CD1+45883681]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E31424+45885556]
QtWebEngineCore::WebContentsAdapterClient::operator= [0x00000001801DD1BF+108927]
QtWebEngineCore::WebContentsAdapterClient::operator= [0x00000001801DCD6D+107821]
QJsonObject::value [0x0000000058BEBE45+4651895]
QUndoGroup::cleanChanged [0x0000000057D52056+263813]
QUndoGroup::cleanChanged [0x0000000057D4CD7B+242602]
QJsonObject::value [0x0000000058B9AB44+4319350]
QJsonObject::value [0x0000000058BA5183+4361909]
QJsonObject::value [0x0000000058B9BFED+4324639]
QJsonObject::value [0x0000000058C4C3EA+5046556]
QJsonObject::value [0x0000000058C49F2E+5037152]
DispatchMessageW [0x00007FFA461200DC+1676]
DispatchMessageW [0x00007FFA4611FC07+439]
QJsonObject::value [0x0000000058C4AB83+5040309]
QJsonObject::value [0x0000000058B95AE8+4298778]
QJsonObject::value [0x0000000058B95D23+4299349]
QtWebEngineCore::WebContentsAdapterClient::operator= [0x00000001801DC3F7+105399]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E333D3+45893667]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E7CDEB+46195259]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182E33255+45893285]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182EAF1CD+46401053]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182EAFE5F+46404271]
QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182ECD53D+46524813]
BaseThreadInitThunk [0x00007FFA45362D92+34]
RtlUserThreadStart [0x00007FFA466A9F64+52]