From d4415b02aff8cb0abc1ccdff05fcf76ac9702d3e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 8 Feb 2019 16:12:02 +0100 Subject: [PATCH] Add fallback help IDs to built-in model Task-number: QTCREATORBUG-15959 Change-Id: I1e022450d09cb0e8565573079e412b26d09ce662 Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/cpphoverhandler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/cpptools/cpphoverhandler.cpp b/src/plugins/cpptools/cpphoverhandler.cpp index f65e701c031..07617a411f3 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 #include @@ -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 = 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); }