[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: setupGui strange interaction with KConfig
From:       Ingo =?utf-8?q?Kl=C3=B6cker?= <kloecker () kde ! org>
Date:       2005-01-23 16:10:16
Message-ID: 200501231710.25900 () erwin ! ingo-kloecker ! de
[Download RAW message or body]


On Sunday 23 January 2005 15:30, Tobias Koenig wrote:
> On Sun, Jan 23, 2005 at 01:05:15PM +0100, Albert Astals Cid wrote:
> > Hi,
>
> Hi Albert,
>
> > look at this test, calling setupGui changes the group of the
> > KInstance KConfig object. That is causing, for example bug
> > http://bugs.kde.org/show_bug.cgi?id=97229 so i don't know if it may
> > be causing any bug more.
>
> I had a similar bug in ksysguard as well some years ago... the
> problem was, that KMainWindow::applyMainWindowSettings() set a new
> group without restoring it. That's fixed in CVS HEAD now.
>
> BTW, I know KConfigGroup should be used instead of KConfigGroupSaver,
> but KConfigGroup is designed in the wrong way IMHO.
>
> I'd would expect to do the following
>
> void foorbar( KConfig *config )
> {
>   KConfigGroup group( config, "myGroup" );
>
>   readValue( &group, "MyKey" );
> }
>
> The problem is, that most methods like 'readValue' expect a KConfig*
> and not a KConfigBase*, so you can't really use KConfigGroup in real
> life...

Correct usage is
  myKey = group.readValue( "MyKey" );
which IMO makes much more sense than what you expect. After all we use 
C++ and not C.

Regards,
Ingo

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic