KConfig saving mecanism for kcm

Antoine Gatineau antoine.gatineau at infra-monkey.com
Fri Feb 4 13:05:16 GMT 2022


On Friday, February 4, 2022 12:52:49 PM CET Nicolas Fella wrote:
> On 04/02/2022 12:03, Antoine Gatineau wrote:
> > Hello dear kde developpers.
> >
> > I am writing a kcm module for system settings and I have an issue saving the configuration. So I'm reaching out here.
> > I can use KConfig to save the data but is goes in .config/systemsettingsrc, merged with the rest of systemsettings data.
> >
> > As I have multiple groups, I'd prefer to have a dedicated config file for my kcm.
> >
> > Is KConfig able to do that? How?
> >
> > Thank you for any information or pointer that would allow this behavior.
> > If this is not the right place for such questions, please tell me were to go.
> >
> > Kind regards
> > Antoine
> 
> Hi,
> 
> when creating a KConfig object without arguments it chooses the config
> file based on the app name, which is what you see here.
> 
> By passing a name with it you can choose the config file, e.g.
> KConfig("mysettings") will save in .config/mysettings
> 
> Cheers
> 
> Nico
> 
> 

Oh, I find my mistake.
As a member variable of the class it doesn't seem to work right.
as a local variable of the method save it works.

I guess it makes sense considering the design.

Sorry for the trouble. And thank you for answering

Antoine






More information about the kde-devel mailing list