diff options
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/webview.cpp | 5 | ||||
-rw-r--r-- | src/webengine/webview.h | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp index 263fb67..5f7fc35 100644 --- a/src/webengine/webview.cpp +++ b/src/webengine/webview.cpp @@ -7,6 +7,7 @@ */ #include "webview.h" +#include <QMenu> // copy page URL #include <QApplication> @@ -47,6 +48,10 @@ WebView::WebView(MainWindow *parentMainWindow, QWidget *parent) }); connect(this, &QWebEngineView::loadProgress, this, [this](int progress) { m_loadProgress = progress; + if(m_loadProgress == 100) { + m_loaded = true; + emit loaded(); + } }); m_pageMenu = new QMenu(); diff --git a/src/webengine/webview.h b/src/webengine/webview.h index 957d181..a274535 100644 --- a/src/webengine/webview.h +++ b/src/webengine/webview.h @@ -10,16 +10,16 @@ #define WEBVIEW_H #include "webpage.h" -#include <QMenu> #include <QWebEngineView> +class QMenu; class MainWindow; class WebView : public QWebEngineView { Q_OBJECT public: explicit WebView(MainWindow *parentMainWindow, QWidget *parent = nullptr); - ~WebView(); + ~WebView() override; QMenu *pageMenu(); @@ -28,6 +28,10 @@ public: int loadProgress() const; signals: + // loadStarted is always emitted, be it page load or in-page request, + // but loadFinished is only emitted when it's a page load + // so emit loaded when a load is emitted (progress == 100) + void loaded(); void newBookmark(const QString &title, const QUrl &url); protected: |