aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/WebViewStack.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-04-05 13:10:43 +0530
committerAkshay Nair <phenax5@gmail.com>2025-04-05 13:14:06 +0530
commit1d9cd2bcb69ccbccea67166f9d42ec8ff6892fae (patch)
tree622d1bb48d35f05b17ef69db1b5919be89b86aab /src/widgets/WebViewStack.cpp
parent2e051fcc4efcfe6af2d3ef22d6a4ba63c9f1c65d (diff)
downloadnull-browser-1d9cd2bcb69ccbccea67166f9d42ec8ff6892fae.tar.gz
null-browser-1d9cd2bcb69ccbccea67166f9d42ec8ff6892fae.zip
Connected url changed event
Diffstat (limited to 'src/widgets/WebViewStack.cpp')
-rw-r--r--src/widgets/WebViewStack.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp
index 10aa6b8..9b7af78 100644
--- a/src/widgets/WebViewStack.cpp
+++ b/src/widgets/WebViewStack.cpp
@@ -4,8 +4,11 @@
#include <QWebEngineProfile>
#include <cstdint>
#include <cstdlib>
+#include <memory>
#include <vector>
+#include "WindowActionRouter.hpp"
+#include "events.hpp"
#include "widgets/WebViewStack.hpp"
static WebViewId next_webview_id = 1;
@@ -49,6 +52,12 @@ WebView *WebViewStack::create_new_webview(const QUrl &url, bool focus) {
connect(webview->page(), &QWebEnginePage::newWindowRequested, this,
&WebViewStack::on_new_webview_request);
+ connect(webview->page(), &QWebEnginePage::urlChanged, this,
+ [webview](const QUrl &url) {
+ // TODO: Add window id
+ WindowActionRouter::instance().dispatch_event(
+ new UrlChangedEvent(url.toString(), webview->get_id(), 0));
+ });
if (focus)
focus_webview(webview->get_id());