KApplication::cut()....

Simon Hausmann hausmann at kde.org
Fri Sep 23 15:42:45 BST 2005


On Friday 23 September 2005 16:50, Benjamin Meyer wrote:
> On Friday 23 September 2005 9:22 am, Joseph Wenninger wrote:
> > 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, ...
>
> yah having functions named cut() was a bad idea and a bad polution of the
> name space, I have moved it into the private class
>
> > 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
>
> If we want that funcionality KStdAction::create should really do that, not
> createAutomaticCutActions.
>
> Ok attached is a new diff.  Let me know what you think.

Looks good to me. But you don't have to make KMainWindowPrivate a QObject or 
add a separate _p.h header file. Just keep everything as it is and add to 
KMainWindow's class declaration at the end:

private:
    Q_PRIVATE_SLOT(d, void cut());
    Q_PRIVATE_SLOT(d, void copy());
    ...

And have the slots as regular methods in the private:

class KMainWindowPrivate
{
    ...
    inline void copy() { invokeEditSlot(SLOT(copy()); }
    ...
};

Feel the power of Qt4's moc! ;-)

Simon




More information about the kde-core-devel mailing list