[PyKDE] QSettings.subkeyList not working?

Hans-Peter Jansen hpj at urpla.net
Sat Nov 9 13:43:01 GMT 2002


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).

What's wrong?

Hans-Peter





More information about the PyQt mailing list