It depends on which widget/Window handles the ctrl-Z event.
By default, if your Qt window has focus, it will handle the event (eg undo 
some typing in a text field) and it will not pass the event through to Maya.
You need to do two things:
- have your GUI ignore ctrl-Z
- have your GUI update when the values it is tracking in Maya change (eg 
when someone undoes something in Maya)

Here's some sample code for ignoring undo events (sorry if the colors are 
terrible, I'm not sure how to fix this in a browser)
    def keyPressEvent(self, event):
        ''' Pass undo and redo through to Max/Maya. '''
        if (event.matches(QtGui.QKeySequence.Undo) or
              event.matches(QtGui.QKeySequence.Redo) or
              event.matches(QtGui.QKeySequence.Save)):
            # Send it up to Max/Maya.
            event.ignore()
        else:
            # Do default Qt behavior.
            super(<class name>, self).keyPressEvent(event)


On Thursday, 27 June 2019 07:30:15 UTC+10, likage wrote:
>
> Adding on, my Gui was created using qt designer
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/5a0ece84-d1af-40ec-9751-151963b3733d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to