summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/help/webenginehelpviewer.cpp16
-rw-r--r--src/plugins/help/webenginehelpviewer.h1
2 files changed, 16 insertions, 1 deletions
diff --git a/src/plugins/help/webenginehelpviewer.cpp b/src/plugins/help/webenginehelpviewer.cpp
index 9ff0b1965a..18c4d865d4 100644
--- a/src/plugins/help/webenginehelpviewer.cpp
+++ b/src/plugins/help/webenginehelpviewer.cpp
@@ -34,6 +34,7 @@
#include <QBuffer>
#include <QContextMenuEvent>
#include <QCoreApplication>
+#include <QTimer>
#include <QVBoxLayout>
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
#include <QWebEngineContextMenuData>
@@ -89,7 +90,20 @@ WebEngineHelpViewer::WebEngineHelpViewer(QWidget *parent) :
setPalette(p);
connect(m_widget, &QWebEngineView::urlChanged, this, &WebEngineHelpViewer::sourceChanged);
- connect(m_widget, &QWebEngineView::loadStarted, this, &WebEngineHelpViewer::slotLoadStarted);
+ connect(m_widget, &QWebEngineView::loadStarted, this, [this] {
+ slotLoadStarted();
+ // Work around QTBUG-65223: if only anchor changed, we never get a loadFinished signal
+ // If a link is clicked in a page, it can happen that the new URL has not yet been set,
+ // so we need to delay a bit...
+ QTimer::singleShot(/*magic timeout=*/150, this, [this] {
+ QUrl urlWithoutFragment = source();
+ urlWithoutFragment.setFragment(QString());
+ qDebug() << urlWithoutFragment << m_previousUrlWithoutFragment;
+ if (urlWithoutFragment == m_previousUrlWithoutFragment)
+ slotLoadFinished();
+ m_previousUrlWithoutFragment = urlWithoutFragment;
+ });
+ });
connect(m_widget, &QWebEngineView::loadFinished, this, &WebEngineHelpViewer::slotLoadFinished);
connect(m_widget, &QWebEngineView::titleChanged, this, &WebEngineHelpViewer::titleChanged);
connect(m_widget->page(), &QWebEnginePage::linkHovered, this, &WebEngineHelpViewer::setToolTip);
diff --git a/src/plugins/help/webenginehelpviewer.h b/src/plugins/help/webenginehelpviewer.h
index d5835c4d6a..390e90ea65 100644
--- a/src/plugins/help/webenginehelpviewer.h
+++ b/src/plugins/help/webenginehelpviewer.h
@@ -97,6 +97,7 @@ public:
private:
WebView *m_widget;
+ QUrl m_previousUrlWithoutFragment;
};
} // namespace Internal