[PyQt] dynamically determine if in a macro?

danny shevitz at lanl.gov
Thu Oct 21 21:00:51 BST 2010


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

I don't believe so. isClean() refers to whether the current command index is
at zero. If I push a command, then begin a macro, isClean will always
be False. Your logic only works if the macro is the first command, which in
general isn't true

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

Again, I don't think this is correct. Index() increments and decrements with
calls to redo/undo and has nothing to do with the count(). I don't even believe
that when in a macro, the count increases until the macro is done. 

D





More information about the PyQt mailing list