diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-07-26 11:59:38 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-07-26 11:59:38 +0530 |
| commit | 2078c60477842d7cf6991148e23979565737a8b5 (patch) | |
| tree | 980e2aea150e85c6b87f2b521fce1006486244d8 | |
| parent | 68448538172663279919b29dd09b5faa51e0628a (diff) | |
| download | null-browser-2078c60477842d7cf6991148e23979565737a8b5.tar.gz null-browser-2078c60477842d7cf6991148e23979565737a8b5.zip | |
Refactor heavy + extras.tabline module (incomplete)
Diffstat (limited to '')
| -rw-r--r-- | TODO.org | 11 | ||||
| -rw-r--r-- | init.lua | 18 | ||||
| -rw-r--r-- | lua/null-browser/api.lua | 1 | ||||
| -rw-r--r-- | lua/null-browser/defaults/vi.lua | 2 | ||||
| -rw-r--r-- | lua/null-browser/extras/tabline.lua | 77 | ||||
| -rw-r--r-- | src/WebViewData.hpp | 18 | ||||
| -rw-r--r-- | src/events/NotificationReceivedEvent.hpp | 3 | ||||
| -rw-r--r-- | src/events/PermissionRequestedEvent.hpp | 3 | ||||
| -rw-r--r-- | src/events/UrlChangedEvent.hpp | 2 | ||||
| -rw-r--r-- | src/keymap/KeySeqParser.cpp | 13 | ||||
| -rw-r--r-- | src/keymap/KeySeqParser.hpp | 12 | ||||
| -rw-r--r-- | src/widgets/BrowserWindow.cpp | 20 | ||||
| -rw-r--r-- | src/widgets/BrowserWindow.hpp | 24 | ||||
| -rw-r--r-- | src/widgets/Decorations.cpp | 35 | ||||
| -rw-r--r-- | src/widgets/Decorations.hpp | 42 | ||||
| -rw-r--r-- | src/widgets/EdgeDecoration.cpp | 10 | ||||
| -rw-r--r-- | src/widgets/EdgeDecoration.hpp | 13 | ||||
| -rw-r--r-- | src/widgets/IWebViewMediator.hpp | 13 | ||||
| -rw-r--r-- | src/widgets/WebViewStack.hpp | 31 |
19 files changed, 226 insertions, 122 deletions
@@ -1,13 +1,16 @@ ** Usable +- [X] Decorations api (just for statusline) +- [X] web.schedule +- [X] Create view with html (web.view.set_html()) - [-] Tests for api -- [ ] Fullscreen - [ ] Run JS in page (web.view.eval_js()) +- [ ] Expose JS <-> lua in page (web.view.expose_js()) +- [ ] web.decorations.*.set_size() - [ ] f-key navigation +- [ ] Fullscreen - [ ] Zoom in/out - [ ] Use table for all internals api options? -- [ ] Permission management (list/allow/deny) lua api - [ ] Generate docs for api -- [ ] Decorations api (just for statusline) ** Bugs - [ ] INVESTIGATE: Check why urlchanged doesnt fire for first url open sometimes @@ -16,6 +19,7 @@ - [ ] web.view apis in `-e` flag from "clients" (non-servers calls) don't work ** Next +- [ ] Permission management (list/allow/deny) lua api - [ ] Tests for window - [ ] More tests for stack - [ ] Tests for router @@ -42,7 +46,6 @@ - [X] vendor web.inspect with build - [ ] Right click context menu items - [ ] Listen to renderprocesstermination signal -- [ ] Create view with html (web.view.set_html()) - [ ] Change instance manager command format ** Later later @@ -1,12 +1,5 @@ print('hello starting up...') --- web.set('new_view_url', 'https://lite.duckduckgo.com') --- web.set('close_window_when_no_views', true) --- web.set('user_agent', --- 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36') --- web.set('downloads_dir', os.getenv('HOME') .. '/Downloads/firefox') --- web.set('permissions_persistance', 'never') - web.opts.downloads_dir = os.getenv('HOME') .. '/Downloads/firefox' web.opts.permissions_persistance = 'never' web.opts.user_agent = @@ -63,7 +56,7 @@ web.event.add_listener('NotificationReceived', { local start_clock = function(win_id) local timer = web.uv.new_timer() - timer:start(500, 500, function() + timer:start(500, 1000, function() local view = web.decorations.bottom.view({ win = win_id }) if view ~= nil then local time = os.date("%X", os.time()) @@ -72,17 +65,12 @@ local start_clock = function(win_id) end) end +require 'null-browser.extras.tabline'.init() + -- Decorations config web.event.add_listener('WinCreated', { callback = function(event) web.decorations.bottom.enable({ win = event.win_id }) - - -- View id will only be available asynchronously after enable - web.schedule(function() - local view = web.decorations.bottom.view({ win = event.win_id }) - print('>>>> view', view) - end) - start_clock(event.win_id) end, }) diff --git a/lua/null-browser/api.lua b/lua/null-browser/api.lua index 8b5cebd..598594e 100644 --- a/lua/null-browser/api.lua +++ b/lua/null-browser/api.lua @@ -318,6 +318,7 @@ local function create_decoration_api(type) __internals.decorations_set_enabled(type, enabled, (opts or {}).win) end; return { + type = function() return type end, enable = function(opts) set_enabled(true, opts) end, disable = function(opts) set_enabled(false, opts) end, is_enabled = function(opts) diff --git a/lua/null-browser/defaults/vi.lua b/lua/null-browser/defaults/vi.lua index 0ef5314..d6193de 100644 --- a/lua/null-browser/defaults/vi.lua +++ b/lua/null-browser/defaults/vi.lua @@ -82,7 +82,7 @@ function M.initialize() web.keymap.set('n', '<space>b', function() local views_list = {} local views = web.view.list() - for index, view in ipairs(web.view.list()) do + for index, view in ipairs(views) do table.insert(views_list, index .. ': ' .. view.title .. ' (' .. view.url .. ')') end diff --git a/lua/null-browser/extras/tabline.lua b/lua/null-browser/extras/tabline.lua new file mode 100644 index 0000000..c278df5 --- /dev/null +++ b/lua/null-browser/extras/tabline.lua @@ -0,0 +1,77 @@ +local tabline = {} + +-- TODO: click interaction +-- TODO: vertical tabs +function tabline.init(opts) + local decoration = (opts or {}).decoration or web.decorations.top + + web.event.add_listener('WinCreated', { + callback = function(event) + decoration.enable({ win = event.win_id }) + tabline.show_tabs_in_window(event.win_id, decoration); + end, + }) + + -- Toggle tabline in current window + web.keymap.set('n', '<c-b>', function() + if decoration.is_enabled({ win = 0 }) then + decoration.disable({ win = 0 }) + else + decoration.enable({ win = 0 }) + end + end) +end + +function tabline.show_tabs_in_window(win_id, decoration) + web.event.add_listener('UrlChanged', { + callback = function() + if not decoration.is_enabled({ win = win_id }) then return end + + web.view.set_html(tabline.tabs_html(), { + view = decoration.view({ win = win_id }), + }) + end, + }) +end + +function tabline.tabs_html() + local views_html = '' + for index, view in ipairs(web.view.list()) do + -- TODO: Sanitize this stuff + local text = index .. ': ' .. view.title .. ' (' .. view.url .. ')' + local classes = 'tab' + if web.view.current() == view.id then classes = classes .. ' current' end + local html = '<div class="' .. classes .. '">' .. text .. '</div>' + views_html = views_html .. html + end + + return '<style>' .. tabline.css() .. '</style>' .. + '<div class="tabs">' .. views_html .. '</div>' +end + +function tabline.css() + return [[ + html, body { + background: #000; + } + .tabs { + display: flex; + align-items: stretch; + height: 100vh; + } + .tab { + flex: 1; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + text-wrap: nowrap; + min-width: 0; + border-left: 1px solid white; + } + .tab.current { + background: #333; + } + ]] +end + +return tabline diff --git a/src/WebViewData.hpp b/src/WebViewData.hpp new file mode 100644 index 0000000..6831d29 --- /dev/null +++ b/src/WebViewData.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include <QtCore> + +using WebViewId = qsizetype; + +enum OpenType : uint8_t { + OpenUrl, + OpenUrlInView, + OpenUrlInBgView, + OpenUrlInWindow, +}; + +struct WebViewData { + WebViewId id; + QString url; + QString title; +}; diff --git a/src/events/NotificationReceivedEvent.hpp b/src/events/NotificationReceivedEvent.hpp index ade2132..fd5a554 100644 --- a/src/events/NotificationReceivedEvent.hpp +++ b/src/events/NotificationReceivedEvent.hpp @@ -16,8 +16,7 @@ public: } void lua_push(lua_State *state) const override { - lua_newtable(state); - SET_FIELD("type", string, kind.toStdString().c_str()) + Event::lua_push(state); SET_FIELD("title", string, notification->title().toStdString().c_str()) SET_FIELD("message", string, notification->message().toStdString().c_str()) SET_FIELD("tag", string, notification->tag().toStdString().c_str()) diff --git a/src/events/PermissionRequestedEvent.hpp b/src/events/PermissionRequestedEvent.hpp index ec03ea5..f6c102a 100644 --- a/src/events/PermissionRequestedEvent.hpp +++ b/src/events/PermissionRequestedEvent.hpp @@ -40,8 +40,7 @@ public: } void lua_push(lua_State *state) const override { - lua_newtable(state); - SET_FIELD("type", string, kind.toStdString().c_str()) + Event::lua_push(state); SET_FIELD("permission_type", string, permission_type()) SET_FIELD("view_id", integer, webview_id) SET_FIELD("win_id", integer, win_id) diff --git a/src/events/UrlChangedEvent.hpp b/src/events/UrlChangedEvent.hpp index ec3980b..29547f2 100644 --- a/src/events/UrlChangedEvent.hpp +++ b/src/events/UrlChangedEvent.hpp @@ -3,9 +3,9 @@ #include <QtCore> #include <lua.hpp> +#include "WebViewData.hpp" #include "events/Event.hpp" #include "widgets/BrowserWindow.hpp" -#include "widgets/WebViewStack.hpp" class UrlChangedEvent : public Event { public: diff --git a/src/keymap/KeySeqParser.cpp b/src/keymap/KeySeqParser.cpp index 555e955..192f436 100644 --- a/src/keymap/KeySeqParser.cpp +++ b/src/keymap/KeySeqParser.cpp @@ -80,3 +80,16 @@ Qt::Key KeySeqParser::parse_key(const QString &key_name) { return Qt::Key_T; } + +KeyMatchType KeySeqParser::key_sequence_match(const KeySequence &target, + const KeySequence ¤t) { + for (int i = 0; i < target.length(); i++) { + if (current.length() <= i) + return KeyMatchType::Pending; + + if (target[i].key != current[i].key || !target[i].mod.testFlags(current[i].mod)) + return KeyMatchType::NoMatch; + } + + return KeyMatchType::Match; +} diff --git a/src/keymap/KeySeqParser.hpp b/src/keymap/KeySeqParser.hpp index 31680a9..3772f4e 100644 --- a/src/keymap/KeySeqParser.hpp +++ b/src/keymap/KeySeqParser.hpp @@ -20,17 +20,7 @@ enum KeyMatchType : uint8_t { class KeySeqParser { public: - static KeyMatchType key_sequence_match(const KeySequence &target, const KeySequence ¤t) { - for (int i = 0; i < target.length(); i++) { - if (current.length() <= i) - return KeyMatchType::Pending; - - if (target[i].key != current[i].key || !target[i].mod.testFlags(current[i].mod)) - return KeyMatchType::NoMatch; - } - - return KeyMatchType::Match; - } + static KeyMatchType key_sequence_match(const KeySequence &target, const KeySequence ¤t); KeySeqParser() = default; KeySequence parse(QString key_sequence); diff --git a/src/widgets/BrowserWindow.cpp b/src/widgets/BrowserWindow.cpp index fe2285b..f97f397 100644 --- a/src/widgets/BrowserWindow.cpp +++ b/src/widgets/BrowserWindow.cpp @@ -23,7 +23,7 @@ BrowserWindow::BrowserWindow(const Configuration &configuration, QWebEngineProfi layout->setSpacing(0); centralWidget()->setLayout(layout); - // Stack of web views + // Stack of web views + decorations webview_stack = new WebViewStack(&configuration, profile, this); decorations = new Decorations(webview_stack, profile, this); layout->addWidget(decorations); @@ -79,3 +79,21 @@ void BrowserWindow::update_permissions_persistance(const QString &persistance) { auto persistance_policy = Configuration::to_permission_persistance_policy(persistance); profile->setPersistentPermissionsPolicy(persistance_policy); } + +IWebViewMediator *BrowserWindow::get_webview_mediator(WebViewId webview_id) { + if (decorations->has_webview(webview_id)) + return decorations; + return webview_stack; +} + +bool BrowserWindow::has_webview(WebViewId webview_id) { + return webview_stack->has_webview(webview_id) || decorations->has_webview(webview_id); +} + +void BrowserWindow::open_url(const QUrl &url, OpenType open_type, WebViewId webview_id) { + get_webview_mediator(webview_id)->open_url(url, open_type, webview_id); +} + +void BrowserWindow::set_html(const QString &html, WebViewId webview_id) { + get_webview_mediator(webview_id)->set_html(html, webview_id); +} diff --git a/src/widgets/BrowserWindow.hpp b/src/widgets/BrowserWindow.hpp index 92eafa7..e434521 100644 --- a/src/widgets/BrowserWindow.hpp +++ b/src/widgets/BrowserWindow.hpp @@ -5,6 +5,7 @@ #include "Configuration.hpp" #include "utils.hpp" #include "widgets/Decorations.hpp" +#include "widgets/IWebViewMediator.hpp" #include "widgets/WebViewStack.hpp" using WindowId = qsizetype; @@ -18,12 +19,10 @@ public: DEFINE_GETTER(get_id, win_id) DEFINE_SETTER(set_id, win_id) - // DELEGATE(webview_stack, has_webview, has_webview) DELEGATE(webview_stack, current_webview_id, current_webview_id) DELEGATE(webview_stack, get_webview_list, get_webview_list) DELEGATE(webview_stack, set_search_text, set_search_text) DELEGATE(webview_stack, open_devtools, open_devtools) - // DELEGATE(webview_stack, open_url, open_url) DELEGATE(webview_stack, webview_history_back, history_back) DELEGATE(webview_stack, webview_history_forward, history_forward) DELEGATE(webview_stack, close, close_webview) @@ -35,23 +34,10 @@ public: DELEGATE(decorations, get_enabled, get_decoration_enabled) DELEGATE(decorations, get_view_id, get_decoration_view_id) - bool has_webview(WebViewId webview_id) { - return webview_stack->has_webview(webview_id) || decorations->has_webview(webview_id); - } - - void open_url(const QUrl &url, OpenType open_type, WebViewId webview_id) { - if (decorations->has_webview(webview_id)) - decorations->open_url(url, webview_id); - else - webview_stack->open_url(url, open_type, webview_id); - } - - void set_html(const QString &html, WebViewId webview_id) { - if (decorations->has_webview(webview_id)) - decorations->set_html(html, webview_id); - else - webview_stack->set_html(html, webview_id); - } + IWebViewMediator *get_webview_mediator(WebViewId webview_id); + bool has_webview(WebViewId webview_id); + void open_url(const QUrl &url, OpenType open_type, WebViewId webview_id); + void set_html(const QString &html, WebViewId webview_id); bool on_window_key_event(QKeyEvent *event); diff --git a/src/widgets/Decorations.cpp b/src/widgets/Decorations.cpp index 9df4c23..223e19a 100644 --- a/src/widgets/Decorations.cpp +++ b/src/widgets/Decorations.cpp @@ -6,6 +6,7 @@ #include <qwidget.h> #include "Decorations.hpp" +#include "WebViewData.hpp" #include "widgets/EdgeDecoration.hpp" Decorations::Decorations(QWidget *content_widget, QWebEngineProfile *profile, QWidget *parent) @@ -36,17 +37,17 @@ Decorations::Decorations(QWidget *content_widget, QWebEngineProfile *profile, QW } void Decorations::set_enabled(DecorationType type, bool enabled) { - auto decoration = get_decoration_widget(type); + auto decoration = get_decoration_widget_type(type); if (decoration.has_value()) decoration.value()->set_enabled(enabled); } bool Decorations::get_enabled(DecorationType type) { - auto decoration = get_decoration_widget(type); + auto decoration = get_decoration_widget_type(type); return decoration.has_value() && decoration.value()->is_enabled(); } -std::optional<EdgeDecoration *> Decorations::get_decoration_widget(DecorationType type) { +std::optional<EdgeDecoration *> Decorations::get_decoration_widget_type(DecorationType type) { switch (type) { case DecorationType::DecorationTop: return decoration_top; @@ -59,3 +60,31 @@ std::optional<EdgeDecoration *> Decorations::get_decoration_widget(DecorationTyp } return nullptr; } + +std::optional<EdgeDecoration *> Decorations::get_decoration_widget_by_view_id(WebViewId view_id) { + for (auto *decoration : decorations()) + if (decoration->get_view_id() == view_id) + return std::make_optional(decoration); + return std::nullopt; +} + +bool Decorations::has_webview(WebViewId view_id) { + return get_decoration_widget_by_view_id(view_id).has_value(); +} + +void Decorations::open_url(const QUrl &url, OpenType /*unused*/, WebViewId view_id) { + auto decoration = get_decoration_widget_by_view_id(view_id); + if (decoration.has_value()) + decoration.value()->set_url(url); +} + +void Decorations::set_html(const QString &html, WebViewId view_id) { + auto decoration = get_decoration_widget_by_view_id(view_id); + if (decoration.has_value()) + decoration.value()->set_html(html); +} + +std::optional<WebViewId> Decorations::get_view_id(DecorationType type) { + auto decoration = get_decoration_widget_type(type); + return decoration.has_value() ? decoration.value()->get_view_id() : std::nullopt; +} diff --git a/src/widgets/Decorations.hpp b/src/widgets/Decorations.hpp index 8eac419..ef81c19 100644 --- a/src/widgets/Decorations.hpp +++ b/src/widgets/Decorations.hpp @@ -1,12 +1,14 @@ #pragma once +#include "WebViewData.hpp" #include "widgets/EdgeDecoration.hpp" -#include "widgets/WebViewStack.hpp" +#include "widgets/IWebViewMediator.hpp" #include <QWidget> #include <QtCore> #include <optional> #include <qwebengineprofile.h> +/// @see DecorationType in ./lua/null-browser/api.lua enum DecorationType : uint8_t { DecorationTop = 1, DecorationBottom = 2, @@ -14,7 +16,7 @@ enum DecorationType : uint8_t { DecorationRight = 4, }; -class Decorations : public QWidget { +class Decorations : public QWidget, public IWebViewMediator { Q_OBJECT public: @@ -23,35 +25,10 @@ public: void set_enabled(DecorationType type, bool enabled); bool get_enabled(DecorationType type); - std::optional<WebViewId> get_view_id(DecorationType type) { - auto decoration = get_decoration_widget(type); - return decoration.has_value() ? decoration.value()->get_view_id() : std::nullopt; - } - - bool has_webview(WebViewId view_id) { - for (auto *decoration : decorations()) - if (decoration->get_view_id() == view_id) - return true; - return false; - } - - void open_url(const QUrl &url, WebViewId view_id) { - for (auto *decoration : decorations()) { - if (decoration->get_view_id() == view_id) { - decoration->set_url(url); - return; - } - } - } - - void set_html(const QString &html, WebViewId view_id) { - for (auto *decoration : decorations()) { - if (decoration->get_view_id() == view_id) { - decoration->set_html(html); - return; - } - } - } + std::optional<WebViewId> get_view_id(DecorationType type); + bool has_webview(WebViewId view_id) override; + void open_url(const QUrl &url, OpenType /*unused*/, WebViewId view_id) override; + void set_html(const QString &html, WebViewId view_id) override; private: EdgeDecoration *decoration_top; @@ -67,5 +44,6 @@ private: decoration_right, }; } - std::optional<EdgeDecoration *> get_decoration_widget(DecorationType type); + std::optional<EdgeDecoration *> get_decoration_widget_type(DecorationType type); + std::optional<EdgeDecoration *> get_decoration_widget_by_view_id(WebViewId view_id); }; diff --git a/src/widgets/EdgeDecoration.cpp b/src/widgets/EdgeDecoration.cpp index 8880294..7f5a59f 100644 --- a/src/widgets/EdgeDecoration.cpp +++ b/src/widgets/EdgeDecoration.cpp @@ -65,3 +65,13 @@ void EdgeDecoration::setup_webview() { } } } + +void EdgeDecoration::set_url(const QUrl &url) { + if (!webview.has_value()) + return; + webview.value()->setUrl(url); +} + +std::optional<WebViewId> EdgeDecoration::get_view_id() { + return webview.has_value() ? std::make_optional(webview.value()->get_id()) : std::nullopt; +} diff --git a/src/widgets/EdgeDecoration.hpp b/src/widgets/EdgeDecoration.hpp index f627636..0a977df 100644 --- a/src/widgets/EdgeDecoration.hpp +++ b/src/widgets/EdgeDecoration.hpp @@ -7,9 +7,9 @@ #include <qwebengineprofile.h> #include <qwebengineview.h> +#include "WebViewData.hpp" #include "utils.hpp" #include "widgets/WebView.hpp" -#include "widgets/WebViewStack.hpp" class EdgeDecoration : public QWidget { Q_OBJECT @@ -20,18 +20,11 @@ public: void set_size(uint16_t size_value); void set_html(const QString &content); void set_enabled(bool enabled_value); - void set_url(const QUrl &url) { - if (!webview.has_value()) - return; - webview.value()->setUrl(url); - } + void set_url(const QUrl &url); + std::optional<WebViewId> get_view_id(); DEFINE_GETTER(is_enabled, enabled) - std::optional<WebViewId> get_view_id() { - return webview.has_value() ? std::make_optional(webview.value()->get_id()) : std::nullopt; - } - private: bool vertical; std::optional<WebView *> webview = std::nullopt; diff --git a/src/widgets/IWebViewMediator.hpp b/src/widgets/IWebViewMediator.hpp new file mode 100644 index 0000000..d20836a --- /dev/null +++ b/src/widgets/IWebViewMediator.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include "WebViewData.hpp" + +class IWebViewMediator { +public: + IWebViewMediator() = default; + + virtual bool has_webview(WebViewId webview_id) = 0; + + virtual void open_url(const QUrl &url, OpenType open_type, WebViewId webview_id) = 0; + virtual void set_html(const QString &html, WebViewId webview_id) = 0; +}; diff --git a/src/widgets/WebViewStack.hpp b/src/widgets/WebViewStack.hpp index 3da96aa..2096f25 100644 --- a/src/widgets/WebViewStack.hpp +++ b/src/widgets/WebViewStack.hpp @@ -7,24 +7,12 @@ #include <vector> #include "Configuration.hpp" +#include "WebViewData.hpp" +#include "utils.hpp" +#include "widgets/IWebViewMediator.hpp" #include "widgets/WebView.hpp" -using WebViewId = qsizetype; - -enum OpenType : uint8_t { - OpenUrl, - OpenUrlInView, - OpenUrlInBgView, - OpenUrlInWindow, -}; - -struct WebViewData { - WebViewId id; - QString url; - QString title; -}; - -class WebViewStack : public QWidget { +class WebViewStack : public QWidget, public IWebViewMediator { Q_OBJECT public: @@ -33,6 +21,8 @@ public: WebViewStack(const Configuration *configuration, QWebEngineProfile *profile = new QWebEngineProfile, QWidget *parent = nullptr); + DEFINE_GETTER(get_profile, profile) + QList<WebViewData> get_webview_list(); WebView *current_webview(); WebViewId current_webview_id(); @@ -40,9 +30,7 @@ public: QUrl current_url(); void set_webview_url(const QUrl &url, WebViewId webview_id); - bool has_webview(WebViewId webview_id); - - QWebEngineProfile *get_profile() { return profile; } + bool has_webview(WebViewId webview_id) override; /// @deprecated TODO: Remove std::vector<QUrl> urls(); @@ -62,7 +50,8 @@ protected: void on_download_request(QWebEngineDownloadRequest *download); public slots: - void open_url(const QUrl &url, OpenType open_type = OpenType::OpenUrl, WebViewId webview_id = 0); + void open_url(const QUrl &url, OpenType open_type = OpenType::OpenUrl, + WebViewId webview_id = 0) override; void webview_history_back(WebViewId webview_id, qsizetype history_index); void webview_history_forward(WebViewId webview_id, qsizetype history_index); void close(WebViewId webview_id); @@ -72,7 +61,7 @@ public slots: void scroll(WebViewId webview_id, int deltax, int deltay); void scroll_to_top(WebViewId webview_id); void scroll_to_bottom(WebViewId webview_id); - void set_html(const QString &html, WebViewId webview_id = 0); + void set_html(const QString &html, WebViewId webview_id = 0) override; protected slots: void on_new_webview_request(QWebEngineNewWindowRequest &request); |
