PDA

View Full Version : QUndoStack + QUndoView possible bug



Alundra
24th November 2014, 16:56
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

anda_skoa
24th November 2014, 17:53
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,
_

Alundra
24th November 2014, 19:23
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.

anda_skoa
24th November 2014, 19:40
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,
_

Alundra
24th November 2014, 21:48
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

Alundra
25th November 2014, 00:09
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.