[Interest] Reading trees from QSettings
Andreas Pakulat
apaku at gmx.de
Thu Aug 30 20:02:59 CEST 2012
Hi,
On Thu, Aug 30, 2012 at 7:27 PM, Sensei <senseiwa at gmail.com> wrote:
> On 8/30/12 4:39pm, BRM wrote:
>> Are you sure 'sons' and 's.childGroups()' are the same thing? If you
>> don't update 'sons' in the loop, then they're not likely the same
>> thing. IIRC, 's' is manipulated as you move through the file - thus
>> when you do a s.beginGroup()/s.endGroup(), then s.childGroups() will
>> not be the same as that of the "root" (the file in general); it will
>> only tell you what is below the level you are looking at. You can get
>> around that by not using s.beginGroup()/s.endGroup() and instead
>> using "group/group" and "group/value" syntax when looking something
>> up, but that would carry its own drawbacks (such as dynamically
>> computing the "group/group" and "group/value" strings yourself
>> instead of letting QSettings handle them for you).
>
> Ok, that makes sense. But I am wondering: how could childGroups()
> differ, in an INI file, since it does not support nested groups?
While the Microsoft-defined ini-file might not support nested groups,
QSettings does. This is also mentioned in the docs, but I agree its
too much hidden. Its only a short note in the last sentence of
beginGroup.
Andreas
More information about the Interest
mailing list