forked from qt-creator/qt-creator
		
	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 <nikolai.kosjar@theqtcompany.com> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
		@@ -82,13 +82,6 @@ void BaseHoverHandler::appendToolTip(const QString &extension)
 | 
			
		||||
    m_toolTip.append(extension);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BaseHoverHandler::addF1ToToolTip()
 | 
			
		||||
{
 | 
			
		||||
    m_toolTip = QString::fromLatin1("<table><tr><td valign=middle>%1</td><td>  "
 | 
			
		||||
                                    "<img src=\":/texteditor/images/f1.png\"></td>"
 | 
			
		||||
                                    "</tr></table>").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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user