Support in KToggleAction for toggling the text itself

David Faure faure at kde.org
Sun Feb 8 14:17:00 GMT 2004


On Saturday 07 February 2004 12:07, Martijn Klingens wrote:
> On Friday 06 February 2004 18:05, David Faure wrote:
> > The solution:
> > --------------
> > The attached patch adds support for (optionally) toggling the text instead
> > of using a checkmark for toggleactions in menuitems, and uses this support
> > for the show/hide menubar and toolbar actions.
> 
> Hmm, thinking about this... shouldn't this be a setCheckedGuiItem so you can 
> pass both a text and an icon for the checked state?

That's a good point - the 'fullscreen' action (in konqueror) is one example
where the icon is changed when the action is activated. And of course the
tooltip/whatsthis can then be adjusted as well.

Your suggestion for a method name sounds strange though, most of the kdeui API
that takes guiitems doesn't have GuiItem in the name (e.g. void setButtonOK( const KGuiItem &item = KStdGuiItem::ok() );
But setChecked() is already taken, obviously... so we're left with
setCheckedText( const KGuiItem & )? But see below...

> Question is then what a null pixmap means, use the 'normal' pixmap, or no 
> pixmap at all, since both have their uses.

Hmm. I think the usual cases are 
1) to have no pixmap at all
2) to switch the pixmap to another one (e.g. fullscreen action)
3) to keep the same pixmap (e.g. 'show menubar' action).
I can't see a common use case in having a pixmap in one state and none in the other state.

"state"? hmm, interesting.... setCheckedState( const KGuiItem & ) ?

-- 
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