Applet KConfigGroup vs QSettings?
Aaron J. Seigo
aseigo at kde.org
Tue Dec 30 19:32:38 CET 2008
On Tuesday 30 December 2008, David Baron wrote:
> I want to save/read configuration settings for the user (rather than global
> settings).
>
> The applet class provides two KConfigGroup functions:
> config() and config( group)
it also provides globalConfig, which allows you to store settings to be shared
between instances of the same widget.
> Where do these store their data? Global? User?
per-user, in their kde config directory.
> The group name is best the applet name()? user's name?
you don't need to worry about that, it's handled for you. every
applet/containment is guaranteed to have a unique area in the config file (it
uses the containment/applet id to formulate that).
the method that takes a group name is just a convenience method so that you
don't need to do:
KConfigGroup cg = config();
cg = KConfigGroup(&cg, "SomeGroup");
cg.writeEntry ("foo");
but rather just:
config("SomeGroup").writeEntry("foo");
QSettings are not a good idea in this case as you won't get the administration
frills of KConfig and the user will not be able to ship their configuration
with their layout.
the idea behind the config system in Corona/Containment/Applet is that layouts
and their config all stay together in one nice, happy file. =)
> BTW, my phoneapplet is on kde-apps.org is anyone wants to play with it.
cool =)
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Qt Software
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20081230/f975a9d1/attachment.sig
More information about the Plasma-devel
mailing list