Details
Description
#include <QSettings> #include <QVariant> #include <QHash> #include <QDebug> int main() { QSettings pref("foo", "bar"); QVariantHash hash; hash["one"] = 1; hash["three"] = "tres"; hash["seven"] = 7; pref.setValue("baz", hash); hash = pref.value("baz").toHash(); QVariantHash::const_iterator it = hash.begin(); QVariantHash::const_iterator end = hash.end(); for(; it != end; ++it) { qDebug() << it.key() << it.value(); } return 0; }
Above code prints nothing. The created .plist file is broken.
$ plutil -convert xml1 ~/Library/Preferences/com.foo.bar.plist $ cat ~/Library/Preferences/com.foo.bar.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>baz</key> <string>@Variant(</string> </dict> </plist>