CppEditor: Add template enclosing scope on "Insert Declaration"

Change-Id: Iff4893193b56c2ed86b4b9515a1a1df847528369
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Orgad Shaneh
2016-07-31 23:54:48 +03:00
committed by Orgad Shaneh
parent 2890966ec3
commit 5a40bddf08
3 changed files with 59 additions and 1 deletions

View File

@@ -2508,9 +2508,15 @@ QString InsertDeclOperation::generateDeclaration(const Function *function)
oo.showFunctionSignatures = true;
oo.showReturnTypes = true;
oo.showArgumentNames = true;
oo.showEnclosingTemplate = true;
const Symbol *symbol = function;
if (const Scope *enclosingScope = function->enclosingScope()) {
if (const Template *templ = enclosingScope->asTemplate())
symbol = templ;
}
QString decl;
decl += oo.prettyType(function->type(), function->unqualifiedName());
decl += oo.prettyType(symbol->type(), function->unqualifiedName());
decl += QLatin1String(";\n");
return decl;