diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-01-28 13:00:03 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-02-01 11:28:02 +0000 |
commit | 443931c1daa7e1cc6ddb74f53e04a2e35c6fecb0 (patch) | |
tree | 02e343211287557730d849214f3befee3e386985 /src/plugins/cpptools/cpphoverhandler.cpp | |
parent | 1f4b733cc1e079ccb9eaf11d13a65c20a19d882d (diff) | |
download | qt-creator-443931c1daa7e1cc6ddb74f53e04a2e35c6fecb0.tar.gz |
Help: Move resolution of help from multiple candidate IDs to HelpItem
No need for code duplication.
Change-Id: I3d2c795d072b8de5818e1844b8126e526339c0da
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cpphoverhandler.cpp')
-rw-r--r-- | src/plugins/cpptools/cpphoverhandler.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/plugins/cpptools/cpphoverhandler.cpp b/src/plugins/cpptools/cpphoverhandler.cpp index 341899b5d5..f65e701c03 100644 --- a/src/plugins/cpptools/cpphoverhandler.cpp +++ b/src/plugins/cpptools/cpphoverhandler.cpp @@ -30,7 +30,6 @@ #include <coreplugin/helpmanager.h> #include <texteditor/texteditor.h> -#include <utils/optional.h> #include <utils/textutils.h> #include <utils/executeondestruction.h> @@ -61,19 +60,9 @@ void CppHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, Rep const QSharedPointer<CppElement> &cppElement = evaluator.cppElement(); QStringList candidates = cppElement->helpIdCandidates; candidates.removeDuplicates(); - Utils::optional<HelpItem> helpItem; - foreach (const QString &helpId, candidates) { - if (helpId.isEmpty()) - continue; - const QMap<QString, QUrl> helpLinks = HelpManager::linksForIdentifier(helpId); - if (!helpLinks.isEmpty()) { - helpItem.emplace(helpId, cppElement->helpMark, cppElement->helpCategory, helpLinks); - break; - } - } - if (helpItem) - setLastHelpItemIdentified(helpItem.value()); // tool tip appended by decorateToolTip - else + const HelpItem helpItem(candidates, cppElement->helpMark, cppElement->helpCategory); + setLastHelpItemIdentified(helpItem); // tool tip appended by decorateToolTip + if (!helpItem.isValid()) tip += cppElement->tooltip; } setToolTip(tip); |