diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-04-05 19:07:03 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-04-05 19:07:03 +0530 |
| commit | 26504893e75fb33e9d3f01abdebf1d61f362f1b1 (patch) | |
| tree | 2610afb45431ddb53e43161214cb1feaa4f0dd99 /src/widgets/WebViewStack.cpp | |
| parent | f682527b2f81376ca462d14bcbaae9e0ce77561d (diff) | |
| download | null-browser-26504893e75fb33e9d3f01abdebf1d61f362f1b1.tar.gz null-browser-26504893e75fb33e9d3f01abdebf1d61f362f1b1.zip | |
Set url for windows synchronously + handle title change in webview
Diffstat (limited to '')
| -rw-r--r-- | src/widgets/WebViewStack.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp index 5134101..f5e9765 100644 --- a/src/widgets/WebViewStack.cpp +++ b/src/widgets/WebViewStack.cpp @@ -19,9 +19,8 @@ WebViewStack::WebViewStack(const Configuration *configuration, QWebEngineProfile layout->setContentsMargins(0, 0, 0, 0); layout->setStackingMode(QStackedLayout::StackOne); - connect(layout, &QStackedLayout::currentChanged, this, &WebViewStack::current_webview_changed); - - create_new_webview(configuration->new_tab_url, true); + connect(layout, &QStackedLayout::currentChanged, this, + &WebViewStack::current_webview_title_changed); } void WebViewStack::open_url(const QUrl &url, OpenType open_type, WebViewId webview_id) { @@ -54,11 +53,15 @@ WebView *WebViewStack::create_new_webview(const QUrl &url, bool focus) { WindowActionRouter::instance().dispatch_event( new UrlChangedEvent(url.toString(), webview->get_id(), 0)); }); + connect(webview->page(), &QWebEnginePage::titleChanged, this, + [this](const QString & /* title */) { + emit current_webview_title_changed(layout->currentIndex()); + }); if (focus) focus_webview(webview->get_id()); - emit current_webview_changed(layout->currentIndex()); + emit current_webview_title_changed(layout->currentIndex()); return webview; } |
