[Development] QSettings refactor updates

Rafael Roquetto rafael.roquetto at kdab.com
Sat Oct 11 14:23:45 CEST 2014

On Fri, Oct 10, 2014 at 09:26:11PM -0300, Tomaz Canabrava wrote:
> On Fri, Oct 10, 2014 at 6:35 AM, Milian Wolff <milian.wolff at kdab.com> wrote:
> It's too error prone regarding typos.

This is easily solved by using constants instead of string literals.

 const QLatin1String SettingsGroup("blah");
 const QLatin1String WidthKey("width");

 KConfig c;
 KConfigGroup g = c.group(SettingsGroup);
 g.setValue(WidthKey, 10);

 //  otherfile
 Kconfig c;
 KConfigGroup g = c.group(SettingsGroup);

How do you intend to fix string literal typos? IMHO compile-time checks are
better than run-time checks in these cases.


Rafael Roquetto | rafael.roquetto at kdab.com | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4861 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20141011/b4b65a1a/attachment.bin>

More information about the Development mailing list