Undo safe wrapper for the native ``keyPressEvent`` method.

        |Args|

        * ``keyEvent`` (**QKeyEvent**): the key event to process.

        |Returns|

        **None**

        |Raises|

        * **QtmacsArgumentError** if at least one argument has an invalid type.

def keyPressEvent(self, keyEvent: QtGui.QKeyEvent):
        """
        Undo safe wrapper for the native ``keyPressEvent`` method.

        |Args|

        * ``keyEvent`` (**QKeyEvent**): the key event to process.

        |Returns|

        **None**

        |Raises|

        * **QtmacsArgumentError** if at least one argument has an invalid type.
        """
        undoObj = UndoInsert(self, keyEvent.text())
        self.qteUndoStack.push(undoObj)