Support in KToggleAction for toggling the text itself

Martijn Klingens klingens at kde.org
Sun Feb 8 19:33:03 GMT 2004


On Sunday 08 February 2004 15:17, David Faure wrote:
> 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() );

True... in fact I wrote those methods myself in n7y, so I should have done 
better this time as well ;)

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

Oh, wait... I mistakenly thought you needed to call the method again when 
toggling the action. Indeed you can determine the heuristics of the 'main' 
GUI item.

That would be:

- If the main item has no icon the checked state has none either.
- If the main item has an icon and the checked one has not, the item stays the
  same
- If both provide an icon, the appropriate one is shown

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

Fine with me :)

-- 
Martijn




More information about the kde-core-devel mailing list