diff options
Diffstat (limited to 'src/plugins/help/helpplugin.cpp')
-rw-r--r-- | src/plugins/help/helpplugin.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index fee7634ac0..9c7beb8682 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -719,16 +719,20 @@ void HelpPlugin::activateContext() viewer->stop(); #endif viewer->setSource(source); - } - viewer->setFocus(); - connect(viewer, SIGNAL(loadFinished(bool)), this, - SLOT(highlightSearchTerms())); + connect(viewer, SIGNAL(loadFinished(bool)), this, + SLOT(highlightSearchTerms())); - if (source.toString().remove(source.fragment()) - == oldSource.toString().remove(oldSource.fragment())) { - highlightSearchTerms(); + if (source.toString().remove(source.fragment()) + == oldSource.toString().remove(oldSource.fragment())) { + highlightSearchTerms(); + } + } else { +#if !defined(QT_NO_WEBKIT) + viewer->page()->mainFrame()->scrollToAnchor(source.fragment()); +#endif } } + viewer->setFocus(); } } @@ -857,21 +861,21 @@ void HelpPlugin::highlightSearchTerms() if (name.isEmpty()) continue; - if (m_oldAttrValue == name) { + if (m_oldAttrValue == name + || name.startsWith(m_oldAttrValue + QLatin1Char('-'))) { QWebElement parent = element.parent(); parent.setStyleProperty(property, m_styleProperty); } - if (attrValue == name) { + if (attrValue == name || name.startsWith(attrValue + QLatin1Char('-'))) { QWebElement parent = element.parent(); m_styleProperty = parent.styleProperty(property, - QWebElement::InlineStyle); + QWebElement::ComputedStyle); parent.setStyleProperty(property, QLatin1String("yellow")); } } m_oldAttrValue = attrValue; #endif - viewer->findText(m_idFromContext, 0, false, true); } } |