Commit 33b11f23 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixed prettyprint of template types.

parent 339cb434
......@@ -39,12 +39,23 @@ Overview::Overview()
_showArgumentNames(false),
_showReturnTypes(false),
_showFunctionSignatures(true),
_showFullyQualifiedNames(false)
_showFullyQualifiedNames(false),
_richText(false)
{ }
Overview::~Overview()
{ }
bool Overview::richText() const
{
return _richText;
}
void Overview::setRichText(bool richText)
{
_richText = richText;
}
bool Overview::showArgumentNames() const
{
return _showArgumentNames;
......
......@@ -44,6 +44,9 @@ public:
Overview();
~Overview();
bool richText() const;
void setRichText(bool richText);
bool showArgumentNames() const;
void setShowArgumentNames(bool showArgumentNames);
......@@ -77,6 +80,7 @@ private:
bool _showReturnTypes: 1;
bool _showFunctionSignatures: 1;
bool _showFullyQualifiedNames: 1;
bool _richText: 1;
};
} // end of namespace CPlusPlus
......
......@@ -35,6 +35,7 @@
#include <Scope.h>
#include <QStringList>
#include <QtDebug>
#include <QTextDocument> // Qt::escape()
using namespace CPlusPlus;
......@@ -54,7 +55,7 @@ static QString fullyQualifiedName(Symbol *symbol, const Overview *overview)
}
if (! owner->name())
nestedNameSpecifier.prepend(QLatin1String("<anonymous>"));
nestedNameSpecifier.prepend(QLatin1String("$anonymous"));
else {
const QString name = overview->prettyName(owner->name());
......@@ -325,7 +326,7 @@ void TypePrettyPrinter::visit(Function *type)
if (Argument *arg = type->argumentAt(index)->asArgument()) {
if (index + 1 == _overview->markArgument())
out(QLatin1String("<b>"));
outPlain(QLatin1String("<b>"));
Name *name = 0;
......@@ -335,7 +336,7 @@ void TypePrettyPrinter::visit(Function *type)
out(argumentText(arg->type(), name));
if (index + 1 == _overview->markArgument())
out(QLatin1String("</b>"));
outPlain(QLatin1String("</b>"));
}
}
......@@ -367,9 +368,17 @@ void TypePrettyPrinter::space()
_text += QLatin1Char(' ');
}
void TypePrettyPrinter::out(const QString &text)
void TypePrettyPrinter::outPlain(const QString &text)
{ _text += text; }
void TypePrettyPrinter::out(const QString &text)
{
if (overview()->richText())
_text += Qt::escape(text);
else
_text += text;
}
void TypePrettyPrinter::out(const QChar &ch)
{ _text += ch; }
......
......@@ -72,6 +72,7 @@ protected:
virtual void visit(Enum *type);
void space();
void outPlain(const QString &text);
void out(const QString &text);
void out(const QChar &ch);
void outCV(const FullySpecifiedType &ty);
......
......@@ -382,6 +382,7 @@ bool FunctionArgumentWidget::eventFilter(QObject *obj, QEvent *e)
void FunctionArgumentWidget::updateHintText()
{
Overview overview;
overview.setRichText(true);
overview.setShowReturnTypes(true);
overview.setShowArgumentNames(true);
overview.setMarkArgument(m_currentarg + 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment