mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
43b2006d72
when click the button ,the actual request devtools:// was blocked by WebUrlRequestInterceptor
21 lines
650 B
C++
21 lines
650 B
C++
#include "weburlrequestinterceptor.h"
|
|
#include <QDebug>
|
|
#include "utils.hh"
|
|
|
|
WebUrlRequestInterceptor::WebUrlRequestInterceptor(QObject *p)
|
|
:QWebEngineUrlRequestInterceptor(p)
|
|
{
|
|
|
|
}
|
|
void WebUrlRequestInterceptor::interceptRequest( QWebEngineUrlRequestInfo &info) {
|
|
if (QWebEngineUrlRequestInfo::NavigationTypeLink == info.navigationType() && info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame) {
|
|
//workaround to fix devtool "Switch devtool to chinese" interface was blocked.
|
|
if( info.requestUrl().scheme() == "devtools" )
|
|
{
|
|
return;
|
|
}
|
|
emit linkClicked( info.requestUrl() );
|
|
info.block(true);
|
|
}
|
|
}
|