[Interest] Fwd: Re: QUndoStack

Igor Mironchik igor.mironchik at gmail.com
Fri Jun 24 22:02:35 CEST 2016




-------- Forwarded Message --------
Subject: 	Re: [Interest] QUndoStack
Date: 	Fri, 24 Jun 2016 19:35:44 +0300
From: 	Igor Mironchik <igor.mironchik at gmail.com>
To: 	Alan Ezust <alan.ezust at 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.ezust at gmail.com 
<mailto:alan.ezust at 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.mironchik at gmail.com <mailto:igor.mironchik at 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 at qt-project.org <mailto:Interest at qt-project.org>
        http://lists.qt-project.org/mailman/listinfo/interest




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


More information about the Interest mailing list