aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cpphoverhandler.cpp
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2010-10-01 11:15:28 +0200
committerLeandro Melo <leandro.melo@nokia.com>2010-10-01 11:58:02 +0200
commit3e104ce405281fb23ff2ffab24321d07ea7aa0f4 (patch)
tree4412d2a7c3ae8f87f9de67d2397795330c34ae72 /src/plugins/cppeditor/cpphoverhandler.cpp
parent4c0814f7def1e04d7b79e8b509d6b58bc68bed5d (diff)
Tooltips: Do not show -qtnamespace (if any) in the tips.
This is basically for consistency with the docs and with the html extraction mechanism. Reviewed-by: Roberto Raggi
Diffstat (limited to 'src/plugins/cppeditor/cpphoverhandler.cpp')
-rw-r--r--src/plugins/cppeditor/cpphoverhandler.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp
index 2168bc9e2d..c8d1a9ffad 100644
--- a/src/plugins/cppeditor/cpphoverhandler.cpp
+++ b/src/plugins/cppeditor/cpphoverhandler.cpp
@@ -114,14 +114,26 @@ void CppHoverHandler::decorateToolTip()
const TextEditor::HelpItem &help = lastHelpItemIdentified();
if (help.isValid()) {
+ // If Qt is built with a namespace, we still show the tip without it, as
+ // it is in the docs and for consistency with the doc extraction mechanism.
+ const TextEditor::HelpItem::Category category = help.category();
const QString &contents = help.extractContent(false);
if (!contents.isEmpty()) {
- if (help.category() == TextEditor::HelpItem::ClassOrNamespace) {
- setToolTip(Qt::escape(toolTip()));
- appendToolTip(contents);
- } else {
+ if (category == TextEditor::HelpItem::ClassOrNamespace)
+ setToolTip(help.helpId() + contents);
+ else
setToolTip(contents);
- }
+ } else if (category == TextEditor::HelpItem::Typedef ||
+ category == TextEditor::HelpItem::Enum ||
+ category == TextEditor::HelpItem::ClassOrNamespace) {
+ // This approach is a bit limited since it cannot be used for functions
+ // because the help id doesn't really help in that case.
+ QString prefix;
+ if (category == TextEditor::HelpItem::Typedef)
+ prefix = QLatin1String("typedef ");
+ else if (category == TextEditor::HelpItem::Enum)
+ prefix = QLatin1String("enum ");
+ setToolTip(prefix + help.helpId());
}
addF1ToToolTip();
}