From 049b76124258f7579cb735b49df900fa39d17a0a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 26 Jan 2018 12:06:21 +0100 Subject: [PATCH] Fix inconsistency between tool tip and context help MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Nikolai Kosjar --- src/plugins/texteditor/texteditor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index a0cbd176999..32183afc2f7 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -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)