-
Bug
-
Resolution: Incomplete
-
P3: Somewhat important
-
4.5.0
-
None
See this piece of code for reproducing:
#include <QSettings>
#include <QDebug>
#include <QStringList>
bool readTest(QIODevice&, QSettings::SettingsMap &map)
{
map.insert("Test/Test1", "test1");
map.insert("/Test/Test2", "test2"); // <- this makes trouble...
return true;
}
bool writeTest(QIODevice&, const QSettings::SettingsMap&)
{
return true;
}
int main()
{
/* Note, the file ~/.config/test/test.settings must exist. */
QSettings::Format testFormat = QSettings::registerFormat( "settings", readTest, writeTest );
QSettings settings(testFormat, QSettings::UserScope, "test", "test");
qDebug() << settings.allKeys().size();
foreach(QString key, settings.allKeys())
qDebug() << key << settings.value(key);
/* Note, this works even though we haven't inserted a setting with this
* name. We have inserted "Test/Test1"(no preceding slash). */
qDebug() << "value() with leading /" << settings.value("/Test/Test1");
/* This doesn't work.
*/
qDebug() << "value() with leading /" << settings.value("/Test/Test2");
// Conclusion: somewhere slashes are being stripped. */
//
return 0;
}