goldendict-ng/weburlrequestinterceptor.cpp
2021-12-31 22:11:55 +08:00

17 lines
489 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) {
emit linkClicked(info.requestUrl());
info.block(true);
}
}