From 6ed775f56a17a6fc3bb48323bd43373d8589b7b0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 7 Aug 2015 17:21:38 +0200 Subject: Fix wrong context help if tool tip was not shown for focus widget The tool tip never has focus, so it cannot become the IContext that is checked for context help. So, integrate the help id into Utils::ToolTip and check the tool tip first when checking for context help. As a side effect the [F1] button and help id for the tool tip is now also available for use outside of the text editors. Task-number: QTCREATORBUG-5345 Change-Id: Id975703caf161d1183c247e8ad8bb693b90fd306 Reviewed-by: Nikolai Kosjar Reviewed-by: David Schulz --- src/plugins/texteditor/basehoverhandler.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/plugins/texteditor/basehoverhandler.cpp') diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index 08e1bbcdb3..b76250a422 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -82,13 +82,6 @@ void BaseHoverHandler::appendToolTip(const QString &extension) m_toolTip.append(extension); } -void BaseHoverHandler::addF1ToToolTip() -{ - m_toolTip = QString::fromLatin1("" - "
%1  " - "
").arg(m_toolTip); -} - void BaseHoverHandler::setIsDiagnosticTooltip(bool isDiagnosticTooltip) { m_diagnosticTooltip = isDiagnosticTooltip; @@ -133,7 +126,6 @@ void BaseHoverHandler::decorateToolTip() if (!contents.isEmpty()) { setToolTip(toolTip().toHtmlEscaped()); appendToolTip(contents); - addF1ToToolTip(); } } } @@ -143,7 +135,9 @@ void BaseHoverHandler::operateTooltip(TextEditorWidget *editorWidget, const QPoi if (m_toolTip.isEmpty()) Utils::ToolTip::hide(); else - Utils::ToolTip::show(point, m_toolTip, editorWidget); + Utils::ToolTip::show(point, m_toolTip, editorWidget, m_lastHelpItemIdentified.isValid() + ? m_lastHelpItemIdentified.helpId() + : QString()); } } // namespace TextEditor -- cgit v1.2.1