[Interest] Fwd: Re: QUndoStack
Igor Mironchik
igor.mironchik at gmail.com
Fri Jun 24 22:03:03 CEST 2016
-------- Forwarded Message --------
Subject: Re: [Interest] QUndoStack
Date: Fri, 24 Jun 2016 19:38:22 +0300
From: Igor Mironchik <igor.mironchik at gmail.com>
To: Bob Hood <bhood2 at comcast.net>
Your approach is possible. But guess that you move rect in scene by
mouse, then auto redo() is ugly. :)
24.06.2016 18:53 пользователь "Bob Hood" <bhood2 at comcast.net
<mailto:bhood2 at comcast.net>> написал:
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.
Just my $0.02.
_______________________________________________
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/617676c0/attachment.html>
More information about the Interest
mailing list