Don't add the default arguments when completing function definitions.

Fixes QTCREATORBUG-787

Reviewed-by: Erik Verbruggen
This commit is contained in:
Christian Kamm
2010-03-05 15:43:31 +01:00
parent d700b84714
commit 9e75ff8ea2
4 changed files with 22 additions and 4 deletions

View File

@@ -41,7 +41,8 @@ Overview::Overview()
_showArgumentNames(false),
_showReturnTypes(false),
_showFunctionSignatures(true),
_showFullyQualifiedNames(false)
_showFullyQualifiedNames(false),
_showDefaultArguments(true)
{ }
Overview::~Overview()
@@ -117,6 +118,16 @@ void Overview::setShowFullyQualifiedNamed(bool showFullyQualifiedNames)
_showFullyQualifiedNames = showFullyQualifiedNames;
}
bool Overview::showDefaultArguments() const
{
return _showDefaultArguments;
}
void Overview::setShowDefaultArguments(bool showDefaultArguments)
{
_showDefaultArguments = showDefaultArguments;
}
QString Overview::prettyName(const Name *name) const
{
NamePrettyPrinter pp(this);

View File

@@ -56,6 +56,9 @@ public:
bool showFullyQualifiedNames() const;
void setShowFullyQualifiedNamed(bool showFullyQualifiedNames);
bool showDefaultArguments() const;
void setShowDefaultArguments(bool showDefaultArguments);
// argument index that you want to mark
unsigned markedArgument() const;
void setMarkedArgument(unsigned position);
@@ -84,6 +87,7 @@ private:
bool _showReturnTypes: 1;
bool _showFunctionSignatures: 1;
bool _showFullyQualifiedNames: 1;
bool _showDefaultArguments: 1;
};
} // end of namespace CPlusPlus

View File

@@ -340,9 +340,11 @@ void TypePrettyPrinter::visit(Function *type)
_text += argumentText(arg->type(), name);
if (const StringLiteral *initializer = arg->initializer()) {
_text += QLatin1String(" =");
_text += QString::fromUtf8(initializer->chars(), initializer->size());
if (_overview->showDefaultArguments()) {
if (const StringLiteral *initializer = arg->initializer()) {
_text += QLatin1String(" =");
_text += QString::fromUtf8(initializer->chars(), initializer->size());
}
}
if (index + 1 == _overview->markedArgument())