summaryrefslogtreecommitdiff
path: root/plugins/webengine/webview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/webengine/webview.cpp')
-rw-r--r--plugins/webengine/webview.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/plugins/webengine/webview.cpp b/plugins/webengine/webview.cpp
index fab941a9..fc2e4642 100644
--- a/plugins/webengine/webview.cpp
+++ b/plugins/webengine/webview.cpp
@@ -11,7 +11,7 @@
#include <QVBoxLayout>
#include <QWebEngineView>
-WebView::WebView(const QUrl &url, QWidget *parent) : rView(url, parent), view(new QWebEngineView(this))
+WebView::WebView(const QUrl &url, QWidget *parent) : RekonqView(url, parent), view(new QWebEngineView(this))
{
auto *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
@@ -19,8 +19,28 @@ WebView::WebView(const QUrl &url, QWidget *parent) : rView(url, parent), view(ne
setLayout(layout);
connect(view, &QWebEngineView::iconChanged, this, [this](const QIcon &icon) { emit iconChanged(icon); });
- connect(view, &QWebEngineView::urlChanged, this, [this](const QUrl &url) { emit urlChanged(url); });
+ connect(view, &QWebEngineView::urlChanged, this, [this](const QUrl &u) { emit urlChanged(u); });
connect(view, &QWebEngineView::titleChanged, this, [this](const QString &title) { emit titleChanged(title); });
+
+ // load progress
+ connect(view, &QWebEngineView::loadStarted, this, [this]() {
+ m_loadProgress = 0;
+ emit loadStarted();
+ });
+ connect(view, &QWebEngineView::loadProgress, this, [this](int progress) {
+ m_loadProgress = progress;
+ emit loadProgress(progress);
+ });
+ connect(view, &QWebEngineView::loadFinished, this, [this]() {
+ m_loadProgress = 100;
+ emit loadFinished();
+ });
+
view->load(url);
}
+
+void WebView::load(const QUrl &url) { view->load(url); }
+
+QUrl WebView::url() const { return view->url(); }
QString WebView::title() const { return view->title(); }
+QIcon WebView::icon() const { return view->icon(); }