Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-22933

QVariant treats null variants as equal to zero

    XMLWordPrintable

Details

    Description

      At present, the following expression returns true:

      QVariant(int(0)) == QVariant(QVariant::Int)
      

      (The latter creates a "null" QVariant.)

      If this behaviour is intentional, the QVariant autotest (qtbase/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp) should be changed to eliminate the QEXPECT_FAIL call in the operator_eq_eq() test function (e.g. by checking isNull() also).

      If the above behaviour is not intentional, the QVariant implementation should be corrected, which would also result in the QEXPECT_FAIL call being eliminated from the test.

      In either case, the documentation should be updated to clarify the expected behaviour of null QVariants.

      Attachments

        For Gerrit Dashboard: QTBUG-22933
        # Subject Branch Project Status CR V

        Activity

          People

            nierob Nierob
            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes