[Interest] Weird QSettings/QStringList? Was: Reading trees from QSettings

Sensei senseiwa at gmail.com
Thu Aug 30 15:45:45 CEST 2012


Regarding this problem, I've found a way around. It is a nasty way 
around, but it works.

I've added some warnings, and adding a new variable, a QStringList 
constructed from the QSettings:

     QStringList sons = s.childGroups();


In the loop, I check if a group exists, with a call to QSettings, and 
with the "cache" sons I've set.

Well, this call yields *different* results:


     qWarning("evaluating '%s', child %d %d",
        qPrintable(name),
        s.childGroups().contains(name) == true,
        sons.contains(name) == true);



The INI file is this:

[Root]
item\size=4
item\1\name=New File 1
item\2\name=New File 2
item\3\name=New File 3
item\4\name=New Folder

[New%20Folder]
item\1\name=New File
item\size=1



And I get as output different results, as you see from the last 
"evaluating" line:


READING THE WHOLE TREE
root is 0x101129270
DEBUG childgroups 'New Folder,Root'
nodes is not empty
reading size 4
evaluating 'New File 1', child 0 0
appending to Root (0x101129270) file New File 1
evaluating 'New File 2', child 0 0
appending to Root (0x101129270) file New File 2
evaluating 'New File 3', child 0 0
appending to Root (0x101129270) file New File 3
evaluating 'New Folder', child 0 1
appending to Root (0x101129270) folder New Folder
nodes is not empty
reading size 1
evaluating 'New File', child 0 0
appending to New Folder (0x104d38810) file New File




Am I missing something here?











More information about the Interest mailing list