Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.14.2
-
None
Description
Hello everybody,
I need to store a QString. The QString can be a null object (i.e isNull() == true). When I store a null string with QSettings, the string is empty but not a null string. I expect that the isNull property can stored with QSettings.
#include <QString> #include <QVariant> #include <cassert> #include <QSettings> int main(int argc, char *argv[]) { QString string; assert(string.isNull()); // The QString is null QVariant variant(string); assert(variant.isNull()); assert(variant.toString().isNull()); // The QVariant stores it correctly QSettings settings("MyCompaniy"); settings.setValue("test", variant); // I write the variant variant = settings.value("test"); // I read the variant assert(variant.toString().isNull()); // unexpected crash return 0; }