-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.2, 6.9.0, 6.9.1
-
None
#if 0
QSettings writer("./settings.ini", QSettings::IniFormat);
QStringList list;
QVariant var = list;
qDebug() << "var = " << var;
writer.setValue("key", list);
#else
QSettings reader("./settings.ini", QSettings::IniFormat);
QVariant var = reader.value("key");
qDebug() << "var = " << var;
#endif
Why is an empty QStringList stored as @Invalid()? QSettings should ensure that I read the objects I store.
When I execute these two pieces of code sequentially, the read key is correct.
When I read the configuration, in order to avoid multiple function calls (such as first using QSettings:: contains() to determine if it exists, and then using QSettings: value() to obtain the value), I will use the following code:
This bug will cause me to mistakenly believe that the key does not exist, when in fact the key does exist, but it is empty. My business needs to clearly distinguish whether the key does not exist or is empty!