Reserve more space for built-in types in id space.

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 <ogoffart@woboq.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
This commit is contained in:
Jędrzej Nowacki 2012-03-14 15:15:17 +01:00 committed by Qt by Nokia
parent 55fa3c189f
commit 5ea56e93f7
2 changed files with 2 additions and 2 deletions

View File

@ -210,7 +210,7 @@ public:
QReal = sizeof(qreal) == sizeof(double) ? Double : Float, QReal = sizeof(qreal) == sizeof(double) ? Double : Float,
UnknownType = 0, UnknownType = 0,
User = 256 User = 1024
}; };
enum TypeFlag { enum TypeFlag {

View File

@ -2827,7 +2827,7 @@ Q_DECLARE_METATYPE( MyClass )
void tst_QVariant::loadUnknownUserType() void tst_QVariant::loadUnknownUserType()
{ {
qRegisterMetaType<MyClass>("MyClass"); qRegisterMetaType<MyClass>("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)); QByteArray ba(data, sizeof(data));
QDataStream ds(&ba, QIODevice::ReadOnly); QDataStream ds(&ba, QIODevice::ReadOnly);