[Interest] QUndoStack

Igor Mironchik igor.mironchik at gmail.com
Fri Jun 24 14:22:15 CEST 2016


Hello.

I'm adding undo stack to my app. But in the documentation I found:

voidQUndoStack::push(QUndoCommand <qundocommand.html>*cmd)

Pushes cmd on the stack or merges it with the most recently executed 
command. In either case, executes cmd by calling its redo 
<qundostack.html#redo>() function.

And in sources:

void QUndoStack::push(QUndoCommand *cmd)
{
     Q_D(QUndoStack);
     cmd->redo();

So my question is why just pushed to the stack undo command executes? 
I.e. why cmd->redo() calls in push()?

If I understand all correctly then cmd->redo() should be called only in 
QUndoStack::redo() method. And in push I just want to push new undo 
command to the stack...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160624/717c017a/attachment.html>


More information about the Interest mailing list