aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2024-03-03 23:23:04 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2024-03-03 23:23:04 +0100
commit9e258f0cc2f1f952c0f76a113446aa6d3b7795a6 (patch)
treed8691d1fe8382dbcd5822dde4de25fe0fcd968ec
parentce8ad7026ef9ad4596c4033d1c368ec77cd8c78b (diff)
webwindow: open url in default browser
-rw-r--r--src/webwindow.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/webwindow.cpp b/src/webwindow.cpp
index d7c25f9..db1944e 100644
--- a/src/webwindow.cpp
+++ b/src/webwindow.cpp
@@ -1,10 +1,12 @@
#include <QtGui/QCloseEvent>
+#include <QtGui/QDesktopServices>
#include <QtWebEngineCore/QWebEngineCookieStore>
+#include <QtWebEngineCore/QWebEngineNewWindowRequest>
+#include <QtWidgets/QApplication>
+#include <iostream>
#include "permissionmanager.hpp"
#include "webwindow.hpp"
-#include <QtWidgets/QApplication>
-#include <iostream>
WebWindow::WebWindow(const QString &url)
: QMainWindow()
@@ -42,6 +44,12 @@ WebWindow::web_configure()
[&](const QUrl origin, QWebEnginePage::Feature feature) {
this->permission_requested(origin, feature);
});
+
+ this->page.connect(&this->page,
+ &QWebEnginePage::newWindowRequested,
+ [=](QWebEngineNewWindowRequest &request) {
+ QDesktopServices::openUrl(request.requestedUrl());
+ });
}
void