PDA

View Full Version : QPlainTextEdit and shortcut override - What is the right way?



Szyk
8th October 2018, 20:57
Hi
I want do 3-rd version of my personal text editor. I want do it in objective and modular way. So I design minimal functionality application core and plugin system (similar to Qt Creator but simpler).
I want to override some of the build in QPlainTextEdit shortcuts. And I want make all QPlainTextEdit shortcuts customizable by my shortcut editor.
I konow there is possible to subclass QPlainTextEdit and overload keyPressEvent() function - I use it in previous versions of my editor and it works. But I think this is crapiest way ever! This is procedural, long as hell with dozens of ifs, and not modular way!
I want make it modular (in order to make possible to customize shortcuts form plugin with the shortcut editor). I want to use QAction to define shortcut. I want get of active action list form QPlainTextEdit.
I know there is actions() function for every QWidget and descendands. Are there chances it will work?!? Or maybe we are stuck with keyPressEvent()?!?

thanks in advance and best regards
Szyk Cech