forked from qt-creator/qt-creator
CppEditor: Prevent showing unwanted function template parameters
Task-number: QTCREATORBUG-28186 Change-Id: Ic52090e873b4defa68cf98e2a5d08f2f0604e714 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -361,11 +361,13 @@ static bool endsWithPtrOrRef(const QString &type)
|
||||
|
||||
void TypePrettyPrinter::visit(Function *type)
|
||||
{
|
||||
if (_overview->showTemplateParameters) {
|
||||
bool showTemplateParameters = _overview->showTemplateParameters;
|
||||
QStringList nameParts = _name.split("::");
|
||||
int i = nameParts.length() - 1;
|
||||
for (Scope *s = type->enclosingScope(); s && i >= 0; s = s->enclosingScope()) {
|
||||
if (Template *templ = s->asTemplate()) {
|
||||
if (s->asClass())
|
||||
showTemplateParameters = true;
|
||||
if (Template *templ = s->asTemplate(); templ && showTemplateParameters) {
|
||||
QString &n = nameParts[i];
|
||||
const int paramCount = templ->templateParameterCount();
|
||||
if (paramCount > 0) {
|
||||
@@ -388,7 +390,6 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
--i;
|
||||
}
|
||||
_name = nameParts.join("::");
|
||||
}
|
||||
|
||||
if (_needsParens) {
|
||||
_text.prepend(QLatin1Char('('));
|
||||
|
@@ -6277,6 +6277,7 @@ QString definitionSignature(const CppQuickFixInterface *assist,
|
||||
oo.includeWhiteSpaceInOperatorName = operatorNameText.contains(QLatin1Char(' '));
|
||||
}
|
||||
const QString nameText = oo.prettyName(LookupContext::minimalName(func, cppCoN, control));
|
||||
oo.showTemplateParameters = false;
|
||||
const FullySpecifiedType tn = rewriteType(func->type(), &env, control);
|
||||
|
||||
return oo.prettyType(tn, nameText);
|
||||
|
Reference in New Issue
Block a user