KApplication::cut()....

Joseph Wenninger jowenn at kde.org
Fri Sep 23 14:22:21 BST 2005


Hi !

1) Why do I have to retrieve the action object, if I just want to cut or copy 
from the currently focused widget ? The focus widget doesn't have to be the 
mainwindow, but could be a child widget, right ? Ok, the advantage would be 
that you don't have to call the slots cut/copy/paste, ...

2) If there are methods like createAutomaticCutActions, they should check if 
the action collection already has a cut action and only create a new one , if 
it doesn't , otherwise return the already existing

Kind regards
Joseph Wenninger

Am Freitag, 23. September 2005 15:02 schrieb Benjamin Meyer:
[SNIP]
> > Why bother with having those functions public at all? Most of the time
> > you just want to get the action object, and for those it definitely makes
> > sense to bind them to a mainwindow.
> >
> > Simon
>
> What functions something like this:
>
>    /**
>      * If the widget with focus provides a cut() slot, call that slot. 
> Thus for a
>      * simple application cut can be implemented as:
>      * \code
>      * createAutomaticCutAction(actionCollection());
>      * \endcode
>      */
>     KAction *createAutomaticCutAction(KActionCollection *collection) const;
>
>
> KAction *KMainWindow::createAutomaticCutAction(KActionCollection
> *collection) const
> {
>     return KStdAction::cut( this, SLOT( invokeEditSlot( SLOT( cut() ) ) ),
> collection );
> }
>
> -Benjamin Meyer




More information about the kde-core-devel mailing list