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

QVariant conversion to QChar fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P4: Low P4: Low
    • None
    • 4.7.0
    • None
    • Windows 7 (64bit), Qt fresh from the 4.7 branch

      We are using a serialization of QVariantMaps into a XML file in creator. We noticed that retrieving QChar from that store fails: Even though the XML serialization does contain the letter we stored originally, reading back that serialization always returns a '\0' character.

      We use QVariant's setValue(string_from_xml) method followed by QVariant's convert(type).

      Observed behavior:

      • Works for QString, int, etc.
      • Conversion to QChar does not work: the QVariant does contain a QChar of '\0', typeName() of the QVariant is empty.

      Expected behavior:\

      • Works for QString, int, etc.
      • Conversion to QChar works. The QVariant will contain a QChar for the first (and only) character in the string we pass to setValue, typeName() should return the proper string for QChar.

      Attached you will find a piece of code which demonstrates the issue.

        1. variantBugNonGui.zip
          0.7 kB
          Paweł Polański
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            biochimia João Abecasis
            jaggernod Paweł Polański
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes