forked from qt-creator/qt-creator
TextEditor: Fix HTML escaping of tool tips
Tool tips without help ID were HTML escaped but never shown in a HTML tool tip. Just always make them rich text. Line endings in plain text must be changed to "<br/>" as well. Change-Id: I9fd378e2c9a58ddf5834d67927fe3da9157cfbc7 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -142,12 +142,15 @@ void BaseHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, Re
|
|||||||
|
|
||||||
void BaseHoverHandler::decorateToolTip()
|
void BaseHoverHandler::decorateToolTip()
|
||||||
{
|
{
|
||||||
m_toolTip = m_toolTip.toHtmlEscaped();
|
if (!m_toolTip.isEmpty())
|
||||||
|
m_toolTip = "<p>" + m_toolTip.toHtmlEscaped().replace('\n', "<br/>") + "</p>";
|
||||||
|
|
||||||
if (lastHelpItemIdentified().isValid() && !lastHelpItemIdentified().isFuzzyMatch()) {
|
if (lastHelpItemIdentified().isValid() && !lastHelpItemIdentified().isFuzzyMatch()) {
|
||||||
const QString &helpContents = lastHelpItemIdentified().extractContent(false);
|
const QString &helpContents = lastHelpItemIdentified().extractContent(false);
|
||||||
if (!helpContents.isEmpty())
|
if (!helpContents.isEmpty()) {
|
||||||
m_toolTip = m_toolTip.isEmpty() ? helpContents : ("<p>" + m_toolTip + "</p><hr/><p>" + helpContents + "</p>");
|
m_toolTip = m_toolTip.isEmpty() ? helpContents
|
||||||
|
: (m_toolTip + "<hr/><p>" + helpContents + "</p>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user