[Development] QSettings refactor updates

Tomaz Canabrava tcanabrava at kde.org
Sat Oct 11 02:26:11 CEST 2014


On Fri, Oct 10, 2014 at 6:35 AM, Milian Wolff <milian.wolff at kdab.com> wrote:

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

It's too error prone regarding typos.

// main.cpp

KConfig c;
KConfigGroup g = c.group("blah");
g.setValue("width", 10);

//  otherfile
Kconfig c;
KConfigGroup g = c.group("blah");
g.value("widht"); // <- no error is issued, this is something that I wanna
have it fixed.



> --
> 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
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20141010/5f92c27e/attachment.html>


More information about the Development mailing list