[PATCH] misbehaving of KToggleActions in exclusiveGroup
l.lunak at suse.cz
Mon Oct 17 12:52:00 BST 2005
On Monday 17 of October 2005 12:52, David Faure wrote:
> On Tuesday 27 September 2005 14:25, David Faure wrote:
> > On Tuesday 27 September 2005 14:16, Tobias Koenig wrote:
> > > Hi,
> > >
> > > when you use several KToggleActions in exclusiveGroup mode and plug
> > > them as KActionList into a menubar the following bug appears:
> > >
> > > 1) Select a non-selected item -> it's checked and all other items of
> > > the group become unchecked.
> > >
> > > 2) Select a selected item -> _all_ items (also the selected) becomes
> > > unchecked...
> > >
> > > The second shouldn't happen, so the attached patch avoids the toggle
> > > when the action is already checked and in a exclusive group.
> > We have a workaround in e.g. kword for this problem, so I agree that
> > there is a problem. I also checked, and the workaround (cf
> > KWView::viewTextMode()) won't break things if the fix is applied.
> > However the reason I didn't fix kdelibs for this back then, was that I
> > thought there might be a case where applications might want "0 or 1
> > actions among this group are selected" instead of what you want (and
> > kword wants), which is "always exactly 1 action among this group is
> > selected". But since then I don't remember seeing such an application. So
> > if nobody objects with a concrete case where an app would want the "0 or
> > 1" behavior, I don't object either; it's certainly confusing for the
> > common "always 1" case.
> Hehe, and of course now that this is in, we found a case where we have the
> need for "0 or 1": that's the case of the subscript/superscript icons in
> kword. This change broke those icons, since it was then impossible to
> select "neither subscript nor superscript".
KWord is not the only app, I ran into this problem last week in Gwenview.
There are actions for various kinds of zoom (to fit/to width/to height) and
when none of them is checked the default is normal size.
> Laurent fixed that by removing setExclusiveGroup for those actions and
> manually unchecking one action when the other one is activated, but still,
> the point remains that this is a behavior-incompatible change which might
> break other KDE-3.x apps that used setExclusiveGroup like koffice did - for
> exclusive actions, but not meaning "always one has to be selected".
> I wonder if we shouldn't have two kind of exclusive groups.
> The "0 or 1" and the "always 1" groups, for lack of better names.
It seems both can make sense.
> "always 1" is often used for "modes" : we have to be in one of those N
> modes, it's not possible to be in no mode at all. "0 or 1" is when the
> default mode (like normal text, neither subscript not superscript) is
> Hmm. setExclusiveGroup( "...", KAction::AlwaysSelectOne ) ?
> Of course it will only make sense if all actions in a group use the same
SuSE CR, s.r.o. e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/
More information about the kde-core-devel