From 5ea56e93f74c0df88aa956199e6bb0db2f17bfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 14 Mar 2012 15:15:17 +0100 Subject: Reserve more space for built-in types in id space. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are running out of type ids for built-in types, 255 is not enough. QMetaType already contains about ~70 types, situation is maybe not tragic now, but there is a great chance that we will want to add more built-in types from different modules like jsondb or declarative. Then it might be tight, because we are not allowed to reorganize type ids (it would be a binary incompatible change). This change was not possible up to now. Old moc generated code assumes that type id can be safely stored in 8 bits. This is source compatible change. Change-Id: Iec600adf6b6196a9f3f06ca6d865911084390cc2 Reviewed-by: Olivier Goffart Reviewed-by: João Abecasis Reviewed-by: Kent Hansen --- src/corelib/kernel/qmetatype.h | 2 +- tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 9931df14e3..21f4bc7afe 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -210,7 +210,7 @@ public: QReal = sizeof(qreal) == sizeof(double) ? Double : Float, UnknownType = 0, - User = 256 + User = 1024 }; enum TypeFlag { diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index b6cb6b3632..1e382dde3a 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -2827,7 +2827,7 @@ Q_DECLARE_METATYPE( MyClass ) void tst_QVariant::loadUnknownUserType() { qRegisterMetaType("MyClass"); - char data[] = {0, 0, 1, 0, 0, 0, 0, 0, 8, 77, 121, 67, 108, 97, 115, 115, 0}; + char data[] = {0, 0, QMetaType::User >> 8 , char(QMetaType::User), 0, 0, 0, 0, 8, 'M', 'y', 'C', 'l', 'a', 's', 's', 0}; QByteArray ba(data, sizeof(data)); QDataStream ds(&ba, QIODevice::ReadOnly); -- cgit v1.2.3