Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
None
-
None
-
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.