aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/WebView.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-04-19 18:43:32 +0530
committerAkshay Nair <phenax5@gmail.com>2025-04-19 18:44:07 +0530
commita9d767b209c503ac7b5dff5132aa213d47dcb608 (patch)
tree6b5625c546ca24fd40e8d6f8306cc7b60713e4cc /src/widgets/WebView.cpp
parent0e95e99e72237058465959d55b77750a9d7c1bef (diff)
downloadnull-browser-a9d767b209c503ac7b5dff5132aa213d47dcb608.tar.gz
null-browser-a9d767b209c503ac7b5dff5132aa213d47dcb608.zip
Add web.view.open_devtools for opening devtools
Diffstat (limited to '')
-rw-r--r--src/widgets/WebView.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/widgets/WebView.cpp b/src/widgets/WebView.cpp
index 300f8ae..aead605 100644
--- a/src/widgets/WebView.cpp
+++ b/src/widgets/WebView.cpp
@@ -1,3 +1,4 @@
+#include <QMainWindow>
#include <QWebEngineView>
#include <QtCore>
@@ -5,3 +6,18 @@
WebView::WebView(uint32_t webview_id, QWebEngineProfile *profile, QWidget *parent_node)
: QWebEngineView(profile, parent_node), id(webview_id) {}
+
+void WebView::open_devtools() {
+ if (devtools_window != nullptr)
+ return;
+
+ devtools_window = new DevtoolsWindow(page()->profile());
+ devtools_window->show();
+
+ connect(devtools_window, &DevtoolsWindow::closed, this, [this]() {
+ devtools_window->deleteLater();
+ devtools_window = nullptr;
+ });
+
+ page()->setDevToolsPage(devtools_window->page());
+}