diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-31 12:30:51 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-31 12:30:51 +0100 |
commit | d1635b36d00b7239cbebcf9f78e9c8615ac1d7d5 (patch) | |
tree | 31525586e8e1fa89093b10b0d88924a27e1c2241 /src/webengine | |
parent | Always connect to local socket (diff) | |
download | smolbote-d1635b36d00b7239cbebcf9f78e9c8615ac1d7d5.tar.xz |
Fixed bug where refresh button and loading bar would get stuck in loading state
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: |