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

customtype example modified to save to .ini file fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.4.1
    • Core: I/O
    • None
    • Qt Creator 9.0.0 based on Qt 6.4.1
    • Linux/X11

    Description

      I modified the customtype example to save to + load from a QSettings "test.ini" file.
      See the attached files.

      Here's the output when I ran the program:

      Original: Message("This is a test.") [QList("Subject: Hello World", "From: address@example.com")]
      Stored: QVariant(Message, Message("This is a test.") [QList("Subject: Hello World", "From: address@example.com")])
      Retrieved: Message("This is a test.") [QList("Subject: Hello World", "From: address@example.com")]
      Saving to .ini file
      QVariant::load: unable to load type 65537.
      QVariant::save: unable to save type 'Message' (type id: 65537).
      
      Loading from .ini file
      Retrieved: Message("This is a test.") [QList("Subject: Hello World", "From: address@example.com")]
      

      The thing is, here's test.ini

      [General]
      message=@Variant(\0\0\0\x7f\0\0\0\bMessage\0)
      

      So it's not storing in test.ini and not reading from it, but still gets the correct data!?!

      Attachments

        1. main.cpp
          1 kB
        2. message.cpp
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            philipashmore Philip Ashmore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change