forked from qt-creator/qt-creator
Fix jumping to an anchor once the page has been scrolled.
Task-number: QTCREATORBUG-2130
(cherry picked from commit 9e352be3b1
)
This commit is contained in:
@@ -719,16 +719,20 @@ void HelpPlugin::activateContext()
|
|||||||
viewer->stop();
|
viewer->stop();
|
||||||
#endif
|
#endif
|
||||||
viewer->setSource(source);
|
viewer->setSource(source);
|
||||||
}
|
connect(viewer, SIGNAL(loadFinished(bool)), this,
|
||||||
viewer->setFocus();
|
SLOT(highlightSearchTerms()));
|
||||||
connect(viewer, SIGNAL(loadFinished(bool)), this,
|
|
||||||
SLOT(highlightSearchTerms()));
|
|
||||||
|
|
||||||
if (source.toString().remove(source.fragment())
|
if (source.toString().remove(source.fragment())
|
||||||
== oldSource.toString().remove(oldSource.fragment())) {
|
== oldSource.toString().remove(oldSource.fragment())) {
|
||||||
highlightSearchTerms();
|
highlightSearchTerms();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#if !defined(QT_NO_WEBKIT)
|
||||||
|
viewer->page()->mainFrame()->scrollToAnchor(source.fragment());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
viewer->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -866,7 +870,7 @@ void HelpPlugin::highlightSearchTerms()
|
|||||||
if (attrValue == name || name.startsWith(attrValue + QLatin1Char('-'))) {
|
if (attrValue == name || name.startsWith(attrValue + QLatin1Char('-'))) {
|
||||||
QWebElement parent = element.parent();
|
QWebElement parent = element.parent();
|
||||||
m_styleProperty = parent.styleProperty(property,
|
m_styleProperty = parent.styleProperty(property,
|
||||||
QWebElement::InlineStyle);
|
QWebElement::ComputedStyle);
|
||||||
parent.setStyleProperty(property, QLatin1String("yellow"));
|
parent.setStyleProperty(property, QLatin1String("yellow"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user