KApplication::cut()....

Benjamin Meyer ben at meyerhome.net
Fri Sep 23 14:02:20 BST 2005


On Friday 23 September 2005 8:14 am, Simon Hausmann wrote:
> On Friday 23 September 2005 14:04, Joseph Wenninger wrote:
> > Hi !
> >
> > I don't think it really belongs to KMainWindow. What about a a KFramework
> > (find a better name) class, which contains all those "global" convenience
> > functions ? I guess there will be more of those in other classes too,
> > which are not really associated with the class they are in ?
>
> 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

-- 
aka icefox
Public Key: http://www.icefox.net/public_key.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050923/7697a2d4/attachment.sig>


More information about the kde-core-devel mailing list