Tooltips: Do not show -qtnamespace (if any) in the tips.

This is basically for consistency with the docs and with the html
extraction mechanism.

Reviewed-by: Roberto Raggi
This commit is contained in:
Leandro Melo
2010-10-01 11:15:28 +02:00
parent 4c0814f7de
commit 3e104ce405
2 changed files with 39 additions and 19 deletions

View File

@@ -66,6 +66,18 @@ namespace {
ch = doc->characterAt(tc->position());
}
}
QStringList stripName(const QString &name) {
QStringList all;
all << name;
int colonColon = 0;
const int size = name.size();
while ((colonColon = name.indexOf(QLatin1String("::"), colonColon)) != -1) {
all << name.right(size - colonColon - 2);
colonColon += 2;
}
return all;
}
}
CppElementEvaluator::CppElementEvaluator(CPPEditor *editor) :
@@ -314,16 +326,7 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration) : CppElement()
declaration->enclosingScope()->isNamespace() ||
declaration->enclosingScope()->isEnum()) {
m_qualifiedName = overview.prettyName(LookupContext::fullyQualifiedName(declaration));
QStringList helpIds;
helpIds << m_qualifiedName;
int colonColon = 0;
const int size = m_qualifiedName.size();
while ((colonColon = m_qualifiedName.indexOf(QLatin1String("::"), colonColon)) != -1) {
helpIds << m_qualifiedName.right(size - colonColon - 2);
colonColon += 2;
}
setHelpIdCandidates(helpIds);
setHelpIdCandidates(stripName(m_qualifiedName));
} else {
m_qualifiedName = m_name;
setHelpIdCandidates(QStringList(m_name));
@@ -489,10 +492,15 @@ CppVariable::CppVariable(Symbol *declaration, const LookupContext &context, Scop
Symbol *symbol = clazz->symbols().at(0);
const QString &name =
overview.prettyName(LookupContext::fullyQualifiedName(symbol));
setTooltip(name);
setHelpCategory(TextEditor::HelpItem::ClassOrNamespace);
setHelpMark(name);
setHelpIdCandidates(QStringList(name));
if (!name.isEmpty()) {
setTooltip(name);
setHelpCategory(TextEditor::HelpItem::ClassOrNamespace);
const QStringList &allNames = stripName(name);
if (!allNames.isEmpty()) {
setHelpMark(allNames.last());
setHelpIdCandidates(allNames);
}
}
}
}
}