summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpphoverhandler.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-02-08 16:12:02 +0100
committerEike Ziller <eike.ziller@qt.io>2019-02-12 07:40:43 +0000
commitd4415b02aff8cb0abc1ccdff05fcf76ac9702d3e (patch)
tree5255b50b566f7dde2f275917f62e768ec16effc0 /src/plugins/cpptools/cpphoverhandler.cpp
parent4420190192124d8522a9d8eb88a48f887b31ae74 (diff)
downloadqt-creator-d4415b02aff8cb0abc1ccdff05fcf76ac9702d3e.tar.gz
Add fallback help IDs to built-in model
Task-number: QTCREATORBUG-15959 Change-Id: I1e022450d09cb0e8565573079e412b26d09ce662 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cpphoverhandler.cpp')
-rw-r--r--src/plugins/cpptools/cpphoverhandler.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cpphoverhandler.cpp b/src/plugins/cpptools/cpphoverhandler.cpp
index f65e701c03..07617a411f 100644
--- a/src/plugins/cpptools/cpphoverhandler.cpp
+++ b/src/plugins/cpptools/cpphoverhandler.cpp
@@ -26,6 +26,7 @@
#include "cpphoverhandler.h"
#include "cppelementevaluator.h"
+#include "cpptoolsreuse.h"
#include <coreplugin/helpmanager.h>
#include <texteditor/texteditor.h>
@@ -56,14 +57,16 @@ void CppHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, Rep
tip += evaluator.diagnosis();
setPriority(Priority_Diagnostic);
}
+ const QStringList fallback = identifierWordsUnderCursor(tc);
if (evaluator.identifiedCppElement()) {
const QSharedPointer<CppElement> &cppElement = evaluator.cppElement();
- QStringList candidates = cppElement->helpIdCandidates;
- candidates.removeDuplicates();
- const HelpItem helpItem(candidates, cppElement->helpMark, cppElement->helpCategory);
+ const QStringList candidates = cppElement->helpIdCandidates;
+ const HelpItem helpItem(candidates + fallback, cppElement->helpMark, cppElement->helpCategory);
setLastHelpItemIdentified(helpItem); // tool tip appended by decorateToolTip
if (!helpItem.isValid())
tip += cppElement->tooltip;
+ } else {
+ setLastHelpItemIdentified({fallback, {}, HelpItem::Unknown});
}
setToolTip(tip);
}