[PyQt] dynamically determine if in a macro?

Hans-Peter Jansen hpj at urpla.net
Thu Oct 21 19:31:32 BST 2010


On Thursday 21 October 2010, 19:07:21 danny wrote:
> I am implementing undo/redo.Is there any way to dynamically determine
> if you are currently in the middle of a macro? I have a block a code
> that sometimes executes when in a macro and is otherwise ignored. I
> want to know if there is a way to figure out at that moment, by
> querying the QUndoStack object whether a macro is currently in
> progress?

Isn't QUndoStack.isClean(), what you're after? But since beginMacro and 
endMacro can nest, this state might not be meaningful. 

As a wild guess, it might be, that the state where index() and count() 
are equal, is what you want..

Pete


More information about the PyQt mailing list