[Development] Settings API for QML

André Somers andre at familiesomers.nl
Thu Aug 1 07:58:41 CEST 2013


Op 31-7-2013 19:48, Thiago Macieira schreef:
> On quarta-feira, 31 de julho de 2013 08:38:54, Pier Luigi wrote:
>> The QConfiguration class doesn't do much at the moment, it's just a
>> dumb frontend to QSettings that checks whether a key exists in the
>> schema and the value() method gets a default value from the schema
>> when there's no value.
> Why does it need to check the schema? If the value exists in the config file,
> then it exists. If it doesn't exist in the config file, the default is provided
> in the API call.
I do see a use for using a schema right there. Settings can be accessed 
from all over the application. If you use QSettings or QConfiguration or 
whatever for that directly, it means that everywhere you need a specific 
value, you also need the default value. So, you end up duplicating the 
default value to several places in the code, and it won't be easy to 
find all occurrences either. If you define the defaults centrally, at 
least you don't have that issue.

André

-- 
You like Qt?
I am looking for collegues to join me at i-Optics!




More information about the Development mailing list