Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
9e3e5b4b
Commit
9e3e5b4b
authored
Jul 13, 2010
by
Leandro Melo
Browse files
C++ tooltip: Fixing name qualification.
To conform with recent changes that affected LookupContext::fullyQualifiedName.
parent
0adadf0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cpphoverhandler.cpp
View file @
9e3e5b4b
...
...
@@ -283,37 +283,23 @@ void CppHoverHandler::handleLookupItemMatch(const LookupItem &lookupItem, const
overview
.
setShowFullyQualifiedNamed
(
true
);
if
(
!
matchingDeclaration
&&
assignTooltip
)
{
m_toolTip
=
overview
.
prettyType
(
matchingType
,
Q
Latin1
String
(
""
));
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.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment