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

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

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core: I/O
    • Labels:
      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

            Assignee:
            thiago Thiago Macieira
            Reporter:
            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