This commit is contained in:
Martin Rotter 2023-04-21 07:48:26 +02:00
parent fb2c439b40
commit 502e4d88e0
2 changed files with 9 additions and 3 deletions

View File

@ -32,8 +32,6 @@ WebEngineViewer::WebEngineViewer(QWidget* parent) : QWebEngineView(parent), m_br
WebEnginePage* page = new WebEnginePage(this);
setPage(page);
// page->profile()->settings()->setAttribute(QWebEngineSettings::WebAttribute::ScrollAnimatorEnabled, true);
}
bool WebEngineViewer::event(QEvent* event) {

View File

@ -47,7 +47,15 @@ void WebEnginePage::hideUnwantedElements() {
}
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) {
auto blocked = qApp->web()->adBlock()->block(AdblockRequestInfo(url));