aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/WebView.hpp
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.hpp
parent0e95e99e72237058465959d55b77750a9d7c1bef (diff)
downloadnull-browser-a9d767b209c503ac7b5dff5132aa213d47dcb608.tar.gz
null-browser-a9d767b209c503ac7b5dff5132aa213d47dcb608.zip
Add web.view.open_devtools for opening devtools
Diffstat (limited to 'src/widgets/WebView.hpp')
-rw-r--r--src/widgets/WebView.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/widgets/WebView.hpp b/src/widgets/WebView.hpp
index 98dceba..16c039c 100644
--- a/src/widgets/WebView.hpp
+++ b/src/widgets/WebView.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <QMainWindow>
#include <QWebEngineView>
#include <QtCore>
#include <cstdint>
@@ -7,6 +8,29 @@
#include "utils.hpp"
+class DevtoolsWindow : public QMainWindow {
+ Q_OBJECT
+
+public:
+ DevtoolsWindow(QWebEngineProfile *profile, QWidget *parent = nullptr,
+ Qt::WindowFlags flags = Qt::WindowFlags())
+ : QMainWindow(parent, flags) {
+ webengineview = new QWebEngineView(profile, this);
+ this->setCentralWidget(webengineview);
+ }
+
+ DELEGATE(webengineview, page, page)
+
+signals:
+ void closed();
+
+protected:
+ void closeEvent(QCloseEvent * /* event */) override { emit closed(); }
+
+private:
+ QWebEngineView *webengineview;
+};
+
class WebView : public QWebEngineView {
Q_OBJECT
@@ -14,6 +38,10 @@ public:
WebView(uint32_t webview_id, QWebEngineProfile *profile, QWidget *parent_node = nullptr);
DEFINE_GETTER(get_id, id)
+ void open_devtools();
+
private:
uint32_t id;
+
+ DevtoolsWindow *devtools_window = nullptr;
};