Results 1 to 6 of 6

Thread: QUndoStack + QUndoView possible bug

  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QUndoStack + QUndoView possible bug

    Hi,
    I have found a possible bug in QUndoStack+QUndoView, surely the bug is only in QUndoStack since QUndoView calls setIndex of QUndoStack.
    The bug is when I undo and redo step by step I have never problem but if I undo and redo more than one step, I got not the same result.
    Is it possible to overwrite the setIndex QUndoView does to make a custom for-loop to call undo() or redo() of each command ?
    Since all works fine step by step, that looks like a real bug.
    Thanks for the help
    Last edited by Alundra; 24th November 2014 at 16:37.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QUndoStack + QUndoView possible bug

    According to the documentation it should call undo/redo repeatedly until it reaches the target position.
    Have you checked the code of this method?

    Cheers,
    _

  3. #3
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QUndoStack + QUndoView possible bug

    I saw it calls undo and redo using two while, that should do the job but that's weird that doesn't give the same result (means I have a bad result).
    I have tried to call a for loop using undo() using count of the stack and another key to make a for loop of redo() and I got the same bad result.
    Using only undo() and redo() using ctrl+Z and ctrl+Y or click one by one or still clicked on the QUndoView no problem.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QUndoStack + QUndoView possible bug

    Quote Originally Posted by Alundra View Post
    I saw it calls undo and redo using two while, that should do the job but that's weird that doesn't give the same result (means I have a bad result).
    I have tried to call a for loop using undo() using count of the stack and another key to make a for loop of redo() and I got the same bad result.
    Using only undo() and redo() using ctrl+Z and ctrl+Y or click one by one or still clicked on the QUndoView no problem.
    Maybe some timing issue in your command implementations?
    Something requiring event processing between steps?

    Cheers,
    _

  5. #5
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QUndoStack + QUndoView possible bug

    The only important thing is the order and execute each command after the previous is finished.
    I have log and all command call redo() in the good order but something goes wrong.
    The order is important because I have action AddChild and RemoveChild.
    That's not a problem of pointer because I use unique ID.
    The bad result goes for command list like that : 'Add actor', "Add actor", "Add child".
    I click on "<empty>" then on "Add child" to back to the end of list.
    If all command are executed in order, never one problem should happen.
    What goes wrong ?

    EDIT: All looks to be executed in order, I don't understand why that gives bad result but step by step no problem
    (22:23:34) AddActor start
    (22:23:34) AddActor end
    (22:23:34) SetLocalTransformation start
    (22:23:34) SetLocalTransformation end
    (22:23:34) AddActor start
    (22:23:34) AddActor end
    (22:23:34) SetLocalTransformation start
    (22:23:34) SetLocalTransformation end
    (22:23:34) AddChild start
    (22:23:34) AddChild end
    Last edited by Alundra; 24th November 2014 at 21:29.

  6. #6
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QUndoStack + QUndoView possible bug

    SOLVED :
    That's not a qt bug at the end, that's just because when I add actor no one update of the actor is called since no update of the scene is called, local = world in AddChild gives identity.

Similar Threads

  1. QAbstractItemModel with QUndoStack
    By No-Nonsense in forum Qt Programming
    Replies: 7
    Last Post: 28th October 2012, 17:15
  2. Replies: 0
    Last Post: 3rd August 2010, 11:47
  3. QTreeWidget and QUndoStack?
    By olihey in forum Qt Programming
    Replies: 0
    Last Post: 7th July 2010, 09:08
  4. resize QUndoView
    By zack in forum Qt Programming
    Replies: 3
    Last Post: 31st August 2009, 11:31
  5. QUndoStack problem
    By swiety in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2007, 21:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.