I have three text edits: "a", "b", "c". When I type something into any of them, I can hit keyboard shortcut for undo/redo and it works as expected.
I would like to create a menu item which when triggered would undo/redo in the currently focused text edit. Please, can someone tell me how to approach this? Do I have to create a slot (myUndo, myRedo), connect each of "a", "b", "c" to it, check manually which edit has focus and trigger undo/redo on that edit? Or are there any other, more streamlined, ways of doing this? Like connecting to parent widget and letting somehow Qt do the work?
Related problem, although this is to be expected, is that when I connect menu action "Undo" (along with its keyboard shortcut) for edit "a" and I'm editing in "b" and I hit shortcut for "Undo", "a" gets undo-ed, instead of currently focused "b". How to make it undo "a" when "a" is selected, "b" when "b", "c" when "c"? Do I have to "rebind" the menu shortcut/action all the time?
Bookmarks