[PATCH] misbehaving of KToggleActions in exclusiveGroup

Tobias Koenig tokoe at kde.org
Tue Sep 27 13:16:19 BST 2005


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.

Ok to commit to 3.5?

Ciao,
Tobias
-- 
Separate politics from religion and economy!
The Councile of the European Union is an undemocratic and illegal institution!
-------------- next part --------------
Index: kactionclasses.cpp
===================================================================
--- kactionclasses.cpp	(revision 464154)
+++ kactionclasses.cpp	(working copy)
@@ -232,6 +232,10 @@
 
 void KToggleAction::slotActivated()
 {
+  // don't toggle when already checked and part of exclusive group
+  if ( isChecked() && !exclusiveGroup().isEmpty() )
+    return;
+
   setChecked( !isChecked() );
   KAction::slotActivated();
   emit toggled( isChecked() );


More information about the kde-core-devel mailing list