[PyKDE] QSettings.subkeyList not working?
Phil Thompson
phil at river-bank.demon.co.uk
Sun Nov 10 12:55:01 GMT 2002
On Saturday 09 November 2002 12:42 pm, Hans-Peter Jansen wrote:
> Hi Phil et al.,
>
> while adopting QSettings for my hand rolled config stuff, I stumbled
> over the QSettings.subkeyList() not working as expected:
>
> 8< 8< 8< 8< 8<
>
> from qt import *
>
> program = 'test'
> company = 'whatever'
>
> qs = QSettings()
> qs.insertSearchPath(QSettings.Windows, "/%s" % company)
> path = "/%s" % (program)
> qs.writeEntry("%s/value" % path, "ok")
> qs.writeEntry("%s/value2" % path, "ok, too")
> qs.writeEntry("%s/list/test" % path, "not ok")
> qs.writeEntry("%s/list/test2" % path, "not ok, too")
>
> for k in qs.entryList("%s" % path):
> print k, "=", qs.readEntry("%s/%s" % (path, k))[0]
>
> for k in qs.subkeyList("%s" % path):
> for sk in qs.entryList("%s/%s" % (path, k)):
> print k, sk, "=", qs.readEntry("%s/%s/%s" % (path, k, sk))[0]
>
> >8 >8 >8 >8 >8
>
> Qt doc says, entryList return all entries, which are not keys, while
> subkeyList return all keys. At least in my tests under X11/linux,
> subkeyList always return an empty list, but OTOH, they find their way
> into the config file ($HOME/.qt/testrc in this case).
In my testing subkeyList() is returning a list containing only "test". A C++
version does the same thing. I don't know whether it is a bug or a
misunderstanding - but I don't think it is a PyQt problem.
Phil
More information about the PyQt
mailing list