Remove type id/name conversion for QVariant::UserType
QVariant::UserType does not correspond to an actual type named "UserType". This logic didn't make sense. Change-Id: I369911e514f7902fc863cb05174011d6fc15c447 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
parent
4c63838039
commit
283140742a
@ -1590,8 +1590,6 @@ const char *QVariant::typeToName(Type typ)
|
|||||||
{
|
{
|
||||||
if (typ == Invalid)
|
if (typ == Invalid)
|
||||||
return 0;
|
return 0;
|
||||||
if (typ == UserType)
|
|
||||||
return "UserType";
|
|
||||||
|
|
||||||
return QMetaType::typeName(typ);
|
return QMetaType::typeName(typ);
|
||||||
}
|
}
|
||||||
@ -1608,8 +1606,6 @@ QVariant::Type QVariant::nameToType(const char *name)
|
|||||||
{
|
{
|
||||||
if (!name || !*name)
|
if (!name || !*name)
|
||||||
return Invalid;
|
return Invalid;
|
||||||
if (strcmp(name, "UserType") == 0)
|
|
||||||
return UserType;
|
|
||||||
|
|
||||||
int metaType = QMetaType::type(name);
|
int metaType = QMetaType::type(name);
|
||||||
return metaType <= int(LastGuiType) ? QVariant::Type(metaType) : UserType;
|
return metaType <= int(LastGuiType) ? QVariant::Type(metaType) : UserType;
|
||||||
|
@ -1919,7 +1919,7 @@ void tst_QVariant::typeName_data()
|
|||||||
QTest::newRow("39") << int(QVariant::RectF) << QByteArray("QRectF");
|
QTest::newRow("39") << int(QVariant::RectF) << QByteArray("QRectF");
|
||||||
QTest::newRow("40") << int(QVariant::PointF) << QByteArray("QPointF");
|
QTest::newRow("40") << int(QVariant::PointF) << QByteArray("QPointF");
|
||||||
QTest::newRow("41") << int(QVariant::RegExp) << QByteArray("QRegExp");
|
QTest::newRow("41") << int(QVariant::RegExp) << QByteArray("QRegExp");
|
||||||
QTest::newRow("42") << int(QVariant::UserType) << QByteArray("UserType");
|
QTest::newRow("42") << int(QVariant::UserType) << QByteArray();
|
||||||
QTest::newRow("43") << int(QVariant::Matrix) << QByteArray("QMatrix");
|
QTest::newRow("43") << int(QVariant::Matrix) << QByteArray("QMatrix");
|
||||||
QTest::newRow("44") << int(QVariant::Transform) << QByteArray("QTransform");
|
QTest::newRow("44") << int(QVariant::Transform) << QByteArray("QTransform");
|
||||||
QTest::newRow("45") << int(QVariant::Hash) << QByteArray("QVariantHash");
|
QTest::newRow("45") << int(QVariant::Hash) << QByteArray("QVariantHash");
|
||||||
@ -1962,6 +1962,8 @@ void tst_QVariant::typeToName()
|
|||||||
QVERIFY( QVariant::nameToType( "" ) == QVariant::Invalid );
|
QVERIFY( QVariant::nameToType( "" ) == QVariant::Invalid );
|
||||||
QVERIFY( QVariant::nameToType( "foo" ) == QVariant::Invalid );
|
QVERIFY( QVariant::nameToType( "foo" ) == QVariant::Invalid );
|
||||||
|
|
||||||
|
QCOMPARE(QVariant::nameToType("UserType"), QVariant::Invalid);
|
||||||
|
|
||||||
// We don't support these old (Qt3) types anymore.
|
// We don't support these old (Qt3) types anymore.
|
||||||
QCOMPARE(QVariant::nameToType("QIconSet"), QVariant::Invalid);
|
QCOMPARE(QVariant::nameToType("QIconSet"), QVariant::Invalid);
|
||||||
QCOMPARE(QVariant::nameToType("Q3CString"), QVariant::Invalid);
|
QCOMPARE(QVariant::nameToType("Q3CString"), QVariant::Invalid);
|
||||||
|
Loading…
Reference in New Issue
Block a user