Details
-
Suggestion
-
Resolution: Out of scope
-
P2: Important
-
4.3.3
-
None
Description
Consider the following example:
QVariant var1(QVariant::Int);
int intval = 0;
QVariant var2(intval);
qDebug() << (var1 == var2); // prints true
qDebug() << (var1.isNull() == var2.isNull()); // prints false
Since var1 is null, it is expected that it is not equal to the non-null var2.
DECISION: This is a known behavior of QVariant, which interprets == in a "fuzzy" way (a bit like == in JavaScript). Unfortunately, we cannot change this in Qt 4.x without breaking existing applications, but will consider this for Qt 5. I hope we can do it then, because I dislike QVariant's == behavior just as much as you do.