[Interest] QUndoStack
william.crocker at analog.com
william.crocker at analog.com
Fri Jun 24 20:02:27 CEST 2016
On 06/24/2016 11:52 AM, Bob Hood wrote:
> On 6/24/2016 9:42 AM, Alan Ezust wrote:
>> 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?
>
> It has been my experience that this is the typical design of an Undo system. You
> invoke redo() as you inject the undo action into the stack, effectively killing
> two birds with one stone. You don't push an action onto the stack unless it has
> actually been applied. If the Undo stack did not apply the action, there's no
> contract in place to guarantee that the action has been, or will be, applied in
> another context. A subsequent undo() on an action that was never applied means
> you might (in the best case) corrupt the application's data.
>
> It's an effective design, requiring less code, and guaranteeing a valid stack
> state.
>
I have been using it for a while and find it acceptable as well.
Create a command to do something, push it onto the stack and you are done.
I had an issue with "macros" until I just determined that I needed to use them
all of the time.
> Just my $0.02.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
More information about the Interest
mailing list