Make documentation of QVariant::isNull more explicit.
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>
Mon, 24 Sep 2012 13:21:57 +0000 (15:21 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 29 Sep 2012 00:31:35 +0000 (02:31 +0200)
Task-number: QTBUG-22933
Change-Id: I1d8d3fc778ba00bcad11caaaf8af7d87186f18e8
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
src/corelib/kernel/qvariant.cpp
tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp

index d796916..96f2ff6 100644 (file)
@@ -2808,6 +2808,10 @@ bool QVariant::convert(const int type, void *ptr) const
     \a v1. See \l{QVariant::}{canConvert()} for a list of possible
     conversions.
 
+    The result of the function is not affected by the result of QVariant::isNull,
+    which means that two values can be equal even if one of them is null and
+    another is not.
+
     \warning This function doesn't support custom types registered
     with qRegisterMetaType().
 */
@@ -2902,7 +2906,13 @@ void* QVariant::data()
 
 
 /*!
-  Returns true if this is a NULL variant, false otherwise.
+    Returns true if this is a null variant, false otherwise. A variant is
+    considered null if it contains a default constructed value or a built-in
+    type instance that has an isNull method, in which case the result
+    would be the same as calling isNull on the wrapped object.
+
+    \warning The result of the function doesn't affect == operator, which means
+    that two values can be equal even if one of them is null and another is not.
 */
 bool QVariant::isNull() const
 {
index 167711f..a01f8b7 100644 (file)
@@ -1275,7 +1275,7 @@ void tst_QVariant::operator_eq_eq_data()
     // Int
     QTest::newRow( "int1int1" ) << i1 << i1 << true;
     QTest::newRow( "int1int0" ) << i1 << i0 << false;
-    QTest::newRow( "nullint" ) << i0 << QVariant(QVariant::Int) << false;
+    QTest::newRow( "nullint" ) << i0 << QVariant(QVariant::Int) << true;
 
     // LongLong and ULongLong
     QVariant ll1( (qlonglong)1 );
@@ -1492,7 +1492,6 @@ void tst_QVariant::operator_eq_eq()
     QFETCH( QVariant, left );
     QFETCH( QVariant, right );
     QFETCH( bool, equal );
-    QEXPECT_FAIL("nullint", "See QTBUG-22933", Continue);
     QCOMPARE( left == right, equal );
 }