Help: Fix funny blank page when opening same URL again

For some reason the load() calls in the nested HelpViewer::setSource
calls lead to even more nesting because webkit decides to cancel loading
inbetween...... so we make the side bar viewer synchronization async on
the event loop.

Task-number: QTCREATORBUG-12742
Change-Id: I276272af7c477d627638e9611a34e80cca945b21
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
Eike Ziller
2014-10-20 17:22:46 +02:00
parent c6ef3addcc
commit ccc6b09cce
2 changed files with 9 additions and 3 deletions

View File

@@ -444,8 +444,13 @@ void HelpPlugin::updateSideBarSource()
void HelpPlugin::updateSideBarSource(const QUrl &newUrl)
{
if (m_rightPaneSideBarWidget)
m_rightPaneSideBarWidget->currentViewer()->setSource(newUrl);
if (m_rightPaneSideBarWidget) {
// This is called when setSource on the central widget is called.
// Avoid nested setSource calls (even of different help viewers) by scheduling the
// sidebar viewer update on the event loop (QTCREATORBUG-12742)
QMetaObject::invokeMethod(m_rightPaneSideBarWidget->currentViewer(), "setSource",
Qt::QueuedConnection, Q_ARG(QUrl, newUrl));
}
}
void HelpPlugin::fontChanged()

View File

@@ -59,7 +59,8 @@ public:
virtual QString title() const = 0;
virtual QUrl source() const = 0;
virtual void setSource(const QUrl &url) = 0;
// metacall in HelpPlugin::updateSideBarSource
Q_INVOKABLE virtual void setSource(const QUrl &url) = 0;
virtual void scrollToAnchor(const QString &anchor) = 0;
virtual void highlightId(const QString &id) { Q_UNUSED(id) }