Simplify a type information access.
authorJędrzej Nowacki <jedrzej.nowacki@nokia.com>
Mon, 21 May 2012 13:24:19 +0000 (15:24 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 22 May 2012 07:21:28 +0000 (09:21 +0200)
Change-Id: Ife446a14400f5fcb0704f9571015e26f2f6b101a
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
tools/xmlpatterns/qapplicationargumentparser.cpp

index 62a15cc..c5dad71 100644 (file)
@@ -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<void *>(0)).typeName());
+            return QString::fromLatin1(QMetaType::typeName(type));
         }
     }
 }