On segunda-feira, 20 de agosto de 2012 11.22.12, Stephen Chu wrote:
> 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.

No, we don't think so.

We ruled that the constructor with a Type and nothing else was a design flaw.
It creates a null QVariant with a valid type, including types for which null
isn't possible, like int:

bool isNull(int i)
{
        // what goes here?
}

So it's not a complete replacement. When you're replacing your code, you
should also fix the above code to be actually meaningful.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to