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

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

    XMLWordPrintable

Details

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

    Description

      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!
      

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes