summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cpphoverhandler.cpp
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2010-07-13 17:19:36 +0200
committerLeandro Melo <leandro.melo@nokia.com>2010-07-14 09:19:59 +0200
commit9e3e5b4b6f166aa7cdc91bffa6a98149c3073961 (patch)
treeb9b49e31cc8de4707b1fa84bd9667cecab5b103d /src/plugins/cppeditor/cpphoverhandler.cpp
parent0adadf0ff498b8d4c9f8bf9f9a2f7546f73274ac (diff)
downloadqt-creator-9e3e5b4b6f166aa7cdc91bffa6a98149c3073961.tar.gz
C++ tooltip: Fixing name qualification.
To conform with recent changes that affected LookupContext::fullyQualifiedName.
Diffstat (limited to 'src/plugins/cppeditor/cpphoverhandler.cpp')
-rw-r--r--src/plugins/cppeditor/cpphoverhandler.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp
index ba5866aecc..5524643c05 100644
--- a/src/plugins/cppeditor/cpphoverhandler.cpp
+++ b/src/plugins/cppeditor/cpphoverhandler.cpp
@@ -283,37 +283,23 @@ void CppHoverHandler::handleLookupItemMatch(const LookupItem &lookupItem, const
overview.setShowFullyQualifiedNamed(true);
if (!matchingDeclaration && assignTooltip) {
- m_toolTip = overview.prettyType(matchingType, QLatin1String(""));
+ m_toolTip = overview.prettyType(matchingType, QString());
} else {
QString qualifiedName;
- HelpCandidate::Category helpCategory;
if (matchingDeclaration->enclosingSymbol()->isClass() ||
matchingDeclaration->enclosingSymbol()->isNamespace() ||
matchingDeclaration->enclosingSymbol()->isEnum()) {
- // Fully qualify the name if enclosed by a class, namespace or enum.
- QList<const Name *> names = LookupContext::fullyQualifiedName(matchingDeclaration);
- if (matchingDeclaration->isNamespace() ||
- matchingDeclaration->isClass() ||
- matchingDeclaration->isForwardClassDeclaration()) {
- // In this case the declaration name appears in the fully qualified name. Remove
- // it since it is already considered below.
- names.removeLast();
- helpCategory = HelpCandidate::ClassOrNamespace;
- } else if (matchingDeclaration->isEnum()) {
- helpCategory = HelpCandidate::Enum;
- } else if (matchingDeclaration->isTypedef()) {
- helpCategory = HelpCandidate::Typedef;
- } else if (matchingDeclaration->isStatic() && !matchingDeclaration->isFunction()) {
- helpCategory = HelpCandidate::Var;
- } else {
- helpCategory = HelpCandidate::Function;
- }
- foreach (const Name *name, names) {
- qualifiedName.append(overview.prettyName(name));
- qualifiedName.append(QLatin1String("::"));
+ const QList<const Name *> &names =
+ LookupContext::fullyQualifiedName(matchingDeclaration);
+ const int size = names.size();
+ for (int i = 0; i < size; ++i) {
+ qualifiedName.append(overview.prettyName(names.at(i)));
+ if (i < size - 1)
+ qualifiedName.append(QLatin1String("::"));
}
+ } else {
+ qualifiedName.append(overview.prettyName(matchingDeclaration->name()));
}
- qualifiedName.append(overview.prettyName(matchingDeclaration->name()));
if (assignTooltip) {
if (matchingDeclaration->isClass() ||
@@ -326,6 +312,21 @@ void CppHoverHandler::handleLookupItemMatch(const LookupItem &lookupItem, const
}
}
+ HelpCandidate::Category helpCategory;
+ if (matchingDeclaration->isNamespace() ||
+ matchingDeclaration->isClass() ||
+ matchingDeclaration->isForwardClassDeclaration()) {
+ helpCategory = HelpCandidate::ClassOrNamespace;
+ } else if (matchingDeclaration->isEnum()) {
+ helpCategory = HelpCandidate::Enum;
+ } else if (matchingDeclaration->isTypedef()) {
+ helpCategory = HelpCandidate::Typedef;
+ } else if (matchingDeclaration->isStatic() && !matchingDeclaration->isFunction()) {
+ helpCategory = HelpCandidate::Var;
+ } else {
+ helpCategory = HelpCandidate::Function;
+ }
+
// Help identifiers are simply the name with no signature, arguments or return type.
// They might or might not include a qualification. This is why two candidates are
// created.