From 4f485fab26b986a38b0caee7bbf4b16cd265f329 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C4=99drzej=20Nowacki?= Date: Mon, 21 May 2012 15:24:19 +0200 Subject: [PATCH] Simplify a type information access. Change-Id: Ife446a14400f5fcb0704f9571015e26f2f6b101a Reviewed-by: Kent Hansen --- tools/xmlpatterns/qapplicationargumentparser.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/xmlpatterns/qapplicationargumentparser.cpp b/tools/xmlpatterns/qapplicationargumentparser.cpp index 62a15cc..c5dad71 100644 --- a/tools/xmlpatterns/qapplicationargumentparser.cpp +++ b/tools/xmlpatterns/qapplicationargumentparser.cpp @@ -845,7 +845,7 @@ QVariant QApplicationArgumentParser::convertToValue(const QApplicationArgument & QVariant result(input); if(QApplicationArgumentParserPrivate::isBuiltinVariant(type) && - result.convert(QVariant::Type(type))) + result.convert(type)) return result; else return QApplicationArgumentParserPrivate::conversionError(typeToName(argument), input); @@ -859,7 +859,7 @@ QVariant QApplicationArgumentParser::convertToValue(const QApplicationArgument & convertToValue() calls this function when requiring a string for referring to \a type, when generating user messages. - The implementation uses QVariant::typeToName() for most types, but special handles + The implementation uses QMetaType::typeName() for most types, but special handles some types, in order to let the message be better tailored for humans. \sa convertToValue() @@ -880,10 +880,7 @@ QString QApplicationArgumentParser::typeToName(const QApplicationArgument &argum return QLatin1String("string"); default: { - if(QApplicationArgumentParserPrivate::isBuiltinVariant(type)) - return QString::fromLatin1(QVariant::typeToName(QVariant::Type(type))); - else - return QLatin1String(QVariant(type, static_cast(0)).typeName()); + return QString::fromLatin1(QMetaType::typeName(type)); } } } -- 2.7.4