[Interest] QVariant equality

Paul Miller paul at fxtech.com
Wed Apr 3 21:33:50 CEST 2013


On 4/3/2013 2:21 PM, Linos wrote:
> Hello,
> 	is this behavior intended?

...

> So they are "equal", it seems a bit strange to me given one isNull, the other
> have a value and the two variants don't even have the same types, after change
> the value of not_null to 0.01 they are not equal.

QVariant() treats anything that ends up as "zero" as being "null".

Note that QVariant(QVariant::Int) creates a QVariant with zero as the 
value, so it's null.

If you are looking for an "uninitialized" QVariant, use isValid().



More information about the Interest mailing list