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

Serialise type information for all types when using QSettings::IniFormat

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P4: Low
    • None
    • None
    • Core: I/O
    • None

    Description

      Currently, type information is lost when reading settings stored in .ini files; all values will be returned as strings.

      https://doc.qt.io/qt-5/qsettings.html#Format-enum shows that type information is stored for types that QVariant can't convert:

      If you store types that QVariant can't convert to QString (e.g., QPoint, QRect, and QSize), Qt uses an @-based syntax to encode the type. For example:

      pos = @Point(100 100)
      

      To minimize compatibility issues, any @ that doesn't appear at the first position in the value or that isn't followed by a Qt type (Point, Rect, Size, etc.) is treated as a normal character.

      So why not do the same for all types?

      Being able to use .ini is extremely convenient because you can store settings in one place on all platforms that your application targets. Having to use native formats (just to retain type information) is a pain in this regard.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes