[Development] QVairant::Type enums are now obsolete?

Stephen Chu stephen at ju-ju.com
Mon Aug 20 17:22:12 CEST 2012


I just noticed that all the QVariant::Type enums are now marked as 
obsolete in 5.0 doc: 
http://qt-project.org/doc/qt-5.0/qvariant-obsolete.html#Type-enum

The goal seems to be to switch to QMetaType enums. But in the attempt to 
make my code up-to-date, I find that strait replace of the old names 
with the new can be very problematic. For example the following 2 lines 
of code produce different variants:

	QVariant v1(QMetaType::QString);
	QVariant v2(QVariant::String);

v1 is a int with value 10 and v2 is a QString with empty content.

It seems a QVariant constructor that takes a QMetaType::Type is needed.



More information about the Development mailing list