[Interest] QVariant equality
Linos
info at linos.es
Wed Apr 3 21:21:39 CEST 2013
Hello,
is this behavior intended?
main.cpp
#include <iostream>
#include <QtCore/QVariant>
int main(int argc, char *argv[])
{
QVariant null_valid(QVariant::Int);
QVariant not_null(0.0);
bool are_equal = (null_valid == not_null);
std::cout << are_equal << std::endl;
std::cout << null_valid.type() << std::endl;
std::cout << not_null.type() << std::endl;
}
prints this when executed:
1
2
6
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.
Regards,
Miguel Angel.
More information about the Interest
mailing list