diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-02-01 15:52:43 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-02-11 08:24:40 +0000 |
commit | 8309606a52c4fbb6e0e6caadc52b5f36c25fb25a (patch) | |
tree | b55a7e593177e0173dba1b36cd57bc75f363d220 /src/plugins/qmljseditor | |
parent | 52ff4f6f8e20f2a0305bed8ab2f1387996d52076 (diff) |
Help: Lookup in index if ID is not found
And if multiple topics are found in the index, show the topic chooser
dialog that we already have for the help index.
Fixes: QTCREATORBUG-12704
Task-number: QTCREATORBUG-15959
Change-Id: I7afa6f44bbecc12f602aaaa4a11209ec72399689
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r-- | src/plugins/qmljseditor/qmljshoverhandler.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 53b3422c80e..6479ba13ad1 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -147,7 +147,6 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum { QString moduleName = getModuleName(scopeChain, qmlDocument, value); - QString helpId; QStringList helpIdCandidates; QStringList helpIdPieces(qName); @@ -168,7 +167,7 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum helpIdCandidates += helpIdPieces.join('.'); const HelpItem helpItem(helpIdCandidates, qName.join('.'), HelpItem::QmlComponent); - const QMap<QString, QUrl> urlMap = helpItem.links(); + const HelpItem::Links links = helpItem.links(); // Check if the module name contains a major version. QRegularExpression version("^([^\\d]*)(\\d+)\\.*\\d*$"); @@ -176,10 +175,10 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum if (m.hasMatch()) { QMap<QString, QUrl> filteredUrlMap; QStringRef maj = m.capturedRef(2); - for (auto x = urlMap.begin(); x != urlMap.end(); ++x) { - QString urlModuleName = x.value().path().split('/')[1]; + for (const HelpItem::Link &link : links) { + QString urlModuleName = link.second.path().split('/')[1]; if (urlModuleName.contains(maj)) - filteredUrlMap.insert(x.key(), x.value()); + filteredUrlMap.insert(link.first, link.second); } if (!filteredUrlMap.isEmpty()) { // Use the URL, to disambiguate different versions |