Merging settings by group in KConfig
    David Faure 
    faure at kde.org
       
    Mon Apr  3 19:56:28 BST 2006
    
    
  
On Monday 03 April 2006 20:27, Matt Rogers wrote:
> config->setGroup( "Chatwindow:FooContact", "Chatwindow" );
setGroup is deprecated in favour of using KConfigGroup; setGroup 
is too dangerous since it changes the state of KConfig.
> //read an entry. if no entry for the key exists in the real group
> //read the entry from the default group, and if no entry exists there
> //use the specified default.
> config->readEntry("OverriddenKey", "Default"); //returns "NotDefault"
I'm wondering if this shouldn't be done why this can't be done by an extra layer 
above KConfigGroup...  Something like
KConfigGroupWithDefault myGroup( "Chatwindow:FooContact", "Chatwindow" );
myGroup.readEntry("OverriddenKey", "Default");
Should be easy to implement, e.g. with two KConfigGroups as member,
or by deriving from KConfigGroup and adding fallback-lookup.
-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
    
    
More information about the kde-core-devel
mailing list