diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2019-06-27 11:32:29 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2019-07-22 12:58:06 +0000 |
commit | 7425d00427ea62f7b654b873dc61a1f20204cac4 (patch) | |
tree | aa76ba2390ada4fccaaf6d0b81695445352523df /src/plugins/texteditor | |
parent | 90c6bc578fb0e81ebbbfcebddc7e4191ae22d94b (diff) | |
download | qt-creator-7425d00427ea62f7b654b873dc61a1f20204cac4.tar.gz |
Escape tooltip text
The tooltip text may contain characters that need
to be escaped without 'Qt::mightBeRichText' categorizing
this as rich text.
This is needed e.g. to show the proper type when
hovering over a variable of type 'std::vector<int>'
(or some smart pointer) in edit view (no debugging
session).
Otherwise, just "std::vector" is shown since
'Qt::mightBeRichText' returns false for that string
and "<int>" is then probably just ignored as an invalid
tag when the tooltip is displayed.
Change-Id: I25ded2b21e4350a1036ab4b3d8f144383aee776d
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r-- | src/plugins/texteditor/basehoverhandler.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index dfe390d68f..136fa30e76 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -142,15 +142,12 @@ void BaseHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, Re void BaseHoverHandler::decorateToolTip() { - if (Qt::mightBeRichText(toolTip())) - setToolTip(toolTip().toHtmlEscaped()); + m_toolTip = m_toolTip.toHtmlEscaped(); if (lastHelpItemIdentified().isValid() && !lastHelpItemIdentified().isFuzzyMatch()) { const QString &helpContents = lastHelpItemIdentified().extractContent(false); - if (!helpContents.isEmpty()) { - m_toolTip = toolTip().toHtmlEscaped(); + if (!helpContents.isEmpty()) m_toolTip = m_toolTip.isEmpty() ? helpContents : ("<p>" + m_toolTip + "</p><hr/><p>" + helpContents + "</p>"); - } } } |