C++ (Qt) QVariant varNull(QVariant::Double); QVariant var0 = 0.0; if (varNull == var0) { EH_COUT2("varNull.isNull()", varNull.isNull())EH_ENDL; // мои макросы для вывода в стандартный поток EH_COUT2("var0.isNull()", var0.isNull())EH_ENDL; }
C++ (Qt)bool QVariant::cmp(const QVariant &v) const{ QVariant v2 = v; if (d.type != v2.d.type) { if (qIsNumericType(d.type) && qIsNumericType(v.d.type)) { if (qIsFloatingPoint(d.type) || qIsFloatingPoint(v.d.type)) return qFuzzyCompare(toDouble(), v.toDouble()); else return toLongLong() == v.toLongLong(); } if (!v2.canConvert(Type(d.type)) || !v2.convert(Type(d.type))) return false; } return handler->compare(&d, &v2.d);}
return handler->compare(&d, &v2.d);
C++ (Qt)
C++ (Qt)std::numeric_limits<double>::quiet_NaN();
C++ (Qt)QVariant(0.0)==QVariant(QVariant::Double)QVariant(0.0).toDouble()==QVariant(QVariant::Double).toDouble()