KToggleAction in menus

David Faure faure at kde.org
Tue Feb 17 11:12:48 GMT 2009


Reviving an old discussion because the issue isn't completely fixed ;)

On Sunday 06 May 2007, Alex Merry wrote:
> On Sunday 06 May 2007, David Faure wrote:
> > On Tuesday 01 May 2007, Thomas Zander wrote:
> > > Most people don't know if the text shows the current state or the
> > > state we get after clicking on it.
> >
> > Well when the text is phrased like an action ("Hide Menubar") it's
> > pretty clear, no?
> 
> > I do agree that something needs to be fixed, the current kde4
> > behavior is buggy since the text changes -and- a checkbox appears, it
> > should of course be one or the other. However I don't think that
> > reintroducing all the problems (listed above) that setCheckedState
> > fixed, is a good idea. It's nice that Qt4 lets us have checkbox +
> > icon, but it doesn't change the problem that most menuitems describe
> > an action and toggleactions with a checkbox describe a state instead
> > of an action, which is pretty consistent and unintuitive.
> 
> I only pick up this once I've committed, of course.
> 
> I can revert and change KToggleAction to have the old behaviour, 
> although I can't see an easy way of doing that with the Qt API, apart 
> from KToggleAction not being a checkable QAction when an alternative 
> KGuiItem is provided.  Of course, that would ruin the setChecked() 
> slot.
> 
> Personally, I find the checkbox quite intuitive.

We all agreed, back then, that for showing/hiding statusbars/toolbars, not
using setCheckedState() was the best solution (checkbox, no changing text).

However let's take another example: the standard full-screen action (e.g. in konqueror).
It changes its text to "Exit Full Screen Mode", which is nice and clear (no ambiguity
as to whether this is about action or state -- definitely action). The icon changes, too.
But then the checkbox is useless. Ideally, KToggleAction would hide the checkbox 
when setCheckedState is used -- since we all agree that having both is broken
(redundant and possibly confusing).

I don't see how to implement that, however. setCheckable(false) would break the usage
of the action in toolbars - we need the action to have two states... we just don't
want the checkmark for that action in menus. Any ideas?

-- 
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list