1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

WebView: Correctly transfer loading signals when changing page

This commit is contained in:
David Rosca 2018-01-28 23:18:35 +01:00
parent 1fe7f0c232
commit f36799a8da
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 10 additions and 1 deletions

View File

@ -69,7 +69,7 @@ WebPage::WebPage(QObject* parent)
: QWebEnginePage(mApp->webProfile(), parent) : QWebEnginePage(mApp->webProfile(), parent)
, m_fileWatcher(0) , m_fileWatcher(0)
, m_runningLoop(0) , m_runningLoop(0)
, m_loadProgress(-1) , m_loadProgress(100)
, m_blockAlerts(false) , m_blockAlerts(false)
, m_secureStatus(false) , m_secureStatus(false)
{ {

View File

@ -144,6 +144,10 @@ void WebView::setPage(WebPage *page)
} }
if (m_page) { if (m_page) {
if (m_page->isLoading()) {
emit m_page->loadProgress(100);
emit m_page->loadFinished(true);
}
m_page->setView(nullptr); m_page->setView(nullptr);
m_page->deleteLater(); m_page->deleteLater();
} }
@ -152,6 +156,11 @@ void WebView::setPage(WebPage *page)
m_page->setParent(this); m_page->setParent(this);
QWebEngineView::setPage(m_page); QWebEngineView::setPage(m_page);
if (m_page->isLoading()) {
emit loadStarted();
emit loadProgress(m_page->m_loadProgress);
}
connect(m_page, &WebPage::privacyChanged, this, &WebView::privacyChanged); connect(m_page, &WebPage::privacyChanged, this, &WebView::privacyChanged);
connect(m_page, &WebPage::printRequested, this, &WebView::printPage); connect(m_page, &WebPage::printRequested, this, &WebView::printPage);