From 1d9cd2bcb69ccbccea67166f9d42ec8ff6892fae Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 5 Apr 2025 13:10:43 +0530 Subject: Connected url changed event --- src/widgets/WebViewStack.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/widgets') 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 #include #include +#include #include +#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()); -- cgit v1.3.1