3

In the app I'm building, I've implemented a global undo/redo system that's accessible via the normal shortcut keys Ctrl-Z and Ctrl-Shift-Z.

I'm also using QLineEdit fields which have an undo/redo function of their own. Whenever an editingFinished event is triggered (enter is pressed or focus is lost) a global undo event is created. However, if you just type a few letters and then hit Ctrl-Z the field captures the keypress, uses its own undo system to undo your last edit and then does not pass the keypress on.

What I'd like to implement is this:

  1. When the QLineEdit has focus and Ctrl-Z is pressed but there are no edits in the QLineEdit to be undone (when undoAvailable() is False) I'd like the widget to ignore the keypress and pass it on to its parents.

  2. When undo is available and the user calls the global undo/redo actions while the widget has focus (IE pressed the button on the toolbar), I'd like them to be passed on to this widget.

Any ideas?

Michael Clerx
  • 2,928
  • 2
  • 33
  • 47

0 Answers0