[Development] QSettings refactor updates

Milian Wolff milian.wolff at kdab.com
Fri Oct 10 11:35:21 CEST 2014


On Friday 10 October 2014 06:22:12 Tomaz Canabrava wrote:
> Em 10/10/2014 06:18, "Oswald Buddenhagen" <
> 
> oswald.buddenhagen at theqtcompany.com> escreveu:
> > On Fri, Oct 10, 2014 at 11:07:52AM +0200, Milian Wolff wrote:
> > > may I ask why you don't simply copy KConfig? It's API design has
> > > proven to be extremely versatile and efficient over the years.
> > 
> > actually, it has proven horrible and is slated for a rewrite for a
> > decade. the only thing it does right is what tomaz copied to his api.
> 
> (still sleeping, só I will write better latter)  I used kconfig and I
> tougth it was terrible to use, that why I came to thiago and hélio Castro
> asking if I could try a new one.
> 
> I'll read the emails on this thread and change the code accordingly.

Please double-check the KConfig API and copy more of its behavior. Some of 
that stuff was also mentioned by Thiago, Bo and Kai:

QConfig("identifier_or_filename"); // this should also be the root group

config.setValue("bla", 123); // would set a global config value, with multiple 
overloads or template functions

QConfigGroup group = config.group("something"); // smart handle with reference 
semantics
group.readValue("blub", /* default value */); // read value in group, also 
overloads and/or template function

foreach (QConfigGroup subGroup, group.groups()) // or similar
   qDebug() << subGroup.name();

I still think that KConfig, API-wise, is extremely convenient and haven't seen 
anything better so far. The internals and performance is a bit lacking, but 
usually not a problem and definitely not related to the API.

-- 
Qt Developer Days 2014 - October 6 - 8 at BCC, Berlin

Milian Wolff | milian.wolff at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions




More information about the Development mailing list