-------- Forwarded Message --------
Subject:        Re: [Interest] QUndoStack
Date:   Fri, 24 Jun 2016 19:35:44 +0300
From:   Igor Mironchik <igor.mironc...@gmail.com>
To:     Alan Ezust <alan.ez...@gmail.com>



How I missed it?! Thank you for the links. I solved it by undone flag in commands, so redo() does nothing untill undo() done.

24.06.2016 18:42 пользователь "Alan Ezust" <alan.ez...@gmail.com <mailto:alan.ez...@gmail.com>> написал:

   There is another thread on this very subject from last week:

   http://lists.qt-project.org/pipermail/interest/2016-June/023114.html
   http://lists.qt-project.org/pipermail/interest/2016-June/023116.html

   I agree with you, the QUndoStack design is really odd and the need
   to execute commands while pushing (in my view) makes it less
   flexible than it could be. I wonder if we will hear from anyone who
   likes this design?



   On Fri, Jun 24, 2016 at 5:22 AM, Igor Mironchik
   <igor.mironc...@gmail.com <mailto:igor.mironc...@gmail.com>> wrote:

       Hello.

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

       voidQUndoStack::push(QUndoCommand <http://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 <http://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...


       _______________________________________________
       Interest mailing list
       Interest@qt-project.org <mailto:Interest@qt-project.org>
       http://lists.qt-project.org/mailman/listinfo/interest




_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to