Fix inconsistency between tool tip and context help

For the tool tip it moves the position to the start of the word before
passing it to the hoverhandler. That wasn't the case if the user
requests context help, which lead to the strange situation that the tool
tip showed help, but context help at the same position did not (e.g. on
QApplication::topLevelWidgets() with the cursor between the
parentheses).

Related to QTCREATORBUG-15959

Change-Id: I2b9918ea235869c2ddeeba6e749958c10a47d259
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Eike Ziller
2018-01-26 12:06:21 +01:00
parent e44504371c
commit 049b761242

View File

@@ -7934,10 +7934,13 @@ void BaseTextEditor::setContextHelpId(const QString &id)
void TextEditorWidget::contextHelpId(const IContext::HelpIdCallback &callback)
{
if (d->m_contextHelpId.isEmpty() && !d->m_hoverHandlers.isEmpty())
d->m_hoverHandlers.first()->contextHelpId(this, textCursor().position(), callback);
else
if (d->m_contextHelpId.isEmpty() && !d->m_hoverHandlers.isEmpty()) {
d->m_hoverHandlers.first()->contextHelpId(this,
Text::wordStartCursor(textCursor()).position(),
callback);
} else {
callback(d->m_contextHelpId);
}
}
void TextEditorWidget::setContextHelpId(const QString &id)