Request For Comments - Undo/Redo framework

Grace Karanja gracie.karanja89 at gmail.com
Sun Feb 15 07:54:28 PST 2015


On Sun, Feb 15, 2015 at 3:09 AM, Dirk Hohndel <dirk at hohndel.org> wrote:

> Hi Grace...
>
> Thanks. Some comments below...
>
> > diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
> > index 5c08a3f..22e589e 100644
> > --- a/qt-ui/simplewidgets.cpp
> > +++ b/qt-ui/simplewidgets.cpp
> > @@ -200,7 +201,16 @@ void
> ShiftTimesDialog::buttonClicked(QAbstractButton *button)
> >                       amount *= -1;
> >               if (amount != 0) {
> >                       // DANGER, DANGER - this could get our dive_table
> unsorted...
> > -                     shift_times(amount);
>
> At first I thought that this was a bug and that we are now no longer
> shifting time...
>
> But it turns out that we are triggering the 'redo' action right away and
> THAT takes care of applying the action. I found that slightly confusing,
> but it works.
>

I found it a bit confusing too. It turns out that calling
QUndoStack::push(), will call the
redo function in the new command.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150215/7447ff0d/attachment-0001.html>


More information about the subsurface mailing list