Open Norman0406 opened 11 years ago
I think QSettings is not type-safe because it uses a simple key-value storage mechanism where <QString, QString>
or <QString, QInt>
will be stored.
As mentioned in the documentation, you will retrieve an QVariant
object. And that's the point - this can be literally anything :(
I would like to provide a type safe form of storing settings in files, that's why I implemented a custom settings concept which stores value as well as type informaton. However, I noticed QVariant does provide type checking using QVariant::type(). When implementing a custom storage format using QSettings::registerFormat, it might be possible to store type information as well and provide a type safe approach to writing settings to XML.