fixed #386
This commit is contained in:
parent
fb2c439b40
commit
502e4d88e0
@ -32,8 +32,6 @@ WebEngineViewer::WebEngineViewer(QWidget* parent) : QWebEngineView(parent), m_br
|
|||||||
WebEnginePage* page = new WebEnginePage(this);
|
WebEnginePage* page = new WebEnginePage(this);
|
||||||
|
|
||||||
setPage(page);
|
setPage(page);
|
||||||
|
|
||||||
// page->profile()->settings()->setAttribute(QWebEngineSettings::WebAttribute::ScrollAnimatorEnabled, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebEngineViewer::event(QEvent* event) {
|
bool WebEngineViewer::event(QEvent* event) {
|
||||||
|
@ -47,7 +47,15 @@ void WebEnginePage::hideUnwantedElements() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WebEnginePage::acceptNavigationRequest(const QUrl& url, NavigationType type, bool is_main_frame) {
|
bool WebEnginePage::acceptNavigationRequest(const QUrl& url, NavigationType type, bool is_main_frame) {
|
||||||
const RootItem* root = view()->root();
|
if (type == NavigationType::NavigationTypeLinkClicked) {
|
||||||
|
bool open_externally_now =
|
||||||
|
qApp->settings()->value(GROUP(Browser), SETTING(Browser::OpenLinksInExternalBrowserRightAway)).toBool();
|
||||||
|
|
||||||
|
if (open_externally_now) {
|
||||||
|
qApp->web()->openUrlInExternalBrowser(url.toString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_main_frame) {
|
if (is_main_frame) {
|
||||||
auto blocked = qApp->web()->adBlock()->block(AdblockRequestInfo(url));
|
auto blocked = qApp->web()->adBlock()->block(AdblockRequestInfo(url));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user