From 926144dceae4c83ead2675776ec463d428e0b23d Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Fri, 9 Oct 2009 10:27:54 +0200 Subject: [PATCH] Prefer Classes to constructors when building the `help id' --- src/plugins/cppeditor/cpphoverhandler.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp index 6ec74f1384b..99e87288eaf 100644 --- a/src/plugins/cppeditor/cpphoverhandler.cpp +++ b/src/plugins/cppeditor/cpphoverhandler.cpp @@ -337,6 +337,14 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in firstType = resolve(firstType, typeOfExpression.lookupContext(), &resolvedSymbol, &resolvedName); + if (resolvedSymbol && resolvedSymbol->scope()->isClassScope()) { + Class *enclosingClass = resolvedSymbol->scope()->owner()->asClass(); + if (Identifier *id = enclosingClass->identifier()) { + if (id->isEqualTo(resolvedSymbol->identifier())) + resolvedSymbol = enclosingClass; + } + } + m_helpId = buildHelpId(resolvedSymbol, resolvedName); if (m_toolTip.isEmpty()) { @@ -349,7 +357,10 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in overview.setShowReturnTypes(true); overview.setShowFullyQualifiedNamed(true); - if (lookupSymbol && (lookupSymbol->isDeclaration() || lookupSymbol->isArgument())) { + if (symbol == resolvedSymbol && symbol->isClass()) { + m_toolTip = m_helpId; + + } else if (lookupSymbol && (lookupSymbol->isDeclaration() || lookupSymbol->isArgument())) { m_toolTip = overview.prettyType(firstType, buildHelpId(lookupSymbol, lookupSymbol->name())); } else if (firstType->isClassType() || firstType->isEnumType() || -- GitLab