Check QVariant type
I initialize a QVariant this way:
now I need to be sure it’s a float and not a double or an int.
QVariant::Type doesn’t have “float” but I actually check the type this way:
- if(my_variant.type() == QMetaType::Float)
this seems to works but I get a warning while compiling:
- warning: comparison between 'enum QVariant::Type' and 'enum QMetaType::Type'
Is this the right way to check the QVariant type?
After reading the sources:
Note that in Qt 5, the distinction between QVariant::Type and QMetaType::Type will most likely go away.
That’s a good news…