Adding KUndoGroup

Albert Astals Cid aacid at kde.org
Sat May 3 13:05:14 BST 2008


A Divendres 02 Maig 2008, David Faure va escriure:
> On Thursday 01 May 2008, Albert Astals Cid wrote:
> > A Dijous 01 Maig 2008, Albert Astals Cid va escriure:
> > > Might i add KUndoGroup that inherits QUndoGroup and adds proper
> > > QAction *createRedoAction(KActionCollection* actionCollection, const
> > > QString& actionName)
> > > and
> > > QAction *createUndoAction(KActionCollection* actionCollection, const
> > > QString& actionName)
> > > like KUndoStack does?
> > >
> > > That is, set the KDE proper icon, icon text, shortcut and add it to the
> > > actioncollection.
> > >
> > > Albert
> >
> > Well, i did some copy&paste, here is the patch i'm proposing.
>
> Just a thought:
> This data is in KStandardAction already... does one -have- to call
> QUndoGroup::createRedoAction, or couldn't one just do
> KStandardAction::undo(theUndoGroup, SLOT(undo()), this) ? Then we wouldn't
> need KUndoGroup or KUndoStack at all...

No, that is not enough, one needs to do 
connect(theUndoGroup, SIGNAL(canUndoChanged(bool)), theUndoAction, 
SLOT(setEnabled(bool)));
too.

So i'm changing my proposal to mark KUndoStack as deprecated saying you can 
perfectly use KStandardAction and giving a small howto. Ok?

Albert





More information about the kde-core-devel mailing list