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

QVariant: both canConvert() and convert() return 'true' when it shouldn't

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P2: Important P2: Important
    • None
    • 6.3.2, 6.5.1, 6.6.0
    • None

      Simple test case:

      const QString s = QStringLiteral("1685965936385");
      QMetaType target = QMetaType::fromType<int>();
      
      QVariant v(s);
      if (v.canConvert(target) && v.convert(target)) // it's TRUE (but why?)
          QCOMPARE(v.toString(), s); // FAILED!
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            studiosus Vladimir Belyavsky
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes