From 283140742a356ba96612486b1bd613d397029efd Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 27 Jan 2012 14:28:20 +0100 Subject: [PATCH] Remove type id/name conversion for QVariant::UserType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jonas Gastal Reviewed-by: João Abecasis Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira Reviewed-by: Bradley T. Hughes --- src/corelib/kernel/qvariant.cpp | 4 ---- tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 0e89f7b148..c8db27515c 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1590,8 +1590,6 @@ const char *QVariant::typeToName(Type typ) { if (typ == Invalid) return 0; - if (typ == UserType) - return "UserType"; return QMetaType::typeName(typ); } @@ -1608,8 +1606,6 @@ QVariant::Type QVariant::nameToType(const char *name) { if (!name || !*name) return Invalid; - if (strcmp(name, "UserType") == 0) - return UserType; int metaType = QMetaType::type(name); return metaType <= int(LastGuiType) ? QVariant::Type(metaType) : UserType; diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index a1f0fa01bf..2bf554dd78 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -1919,7 +1919,7 @@ void tst_QVariant::typeName_data() QTest::newRow("39") << int(QVariant::RectF) << QByteArray("QRectF"); QTest::newRow("40") << int(QVariant::PointF) << QByteArray("QPointF"); 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("44") << int(QVariant::Transform) << QByteArray("QTransform"); QTest::newRow("45") << int(QVariant::Hash) << QByteArray("QVariantHash"); @@ -1962,6 +1962,8 @@ void tst_QVariant::typeToName() QVERIFY( QVariant::nameToType( "" ) == QVariant::Invalid ); QVERIFY( QVariant::nameToType( "foo" ) == QVariant::Invalid ); + QCOMPARE(QVariant::nameToType("UserType"), QVariant::Invalid); + // We don't support these old (Qt3) types anymore. QCOMPARE(QVariant::nameToType("QIconSet"), QVariant::Invalid); QCOMPARE(QVariant::nameToType("Q3CString"), QVariant::Invalid);