Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Mac qplaintextedit navigation keys
marksibly last edited by
Is there anyway to make a QPlainTextEdit on the Mac use 'windows keys' for navigation, the way qtcreator does?
For example, I currently have to use ctrl-a/ctrl-e to go to start/end of line on the Mac. I would prefer to be able to use home/end as on pc/qtcreator. Ditto for top of document, end of document etc.
I'm using qt4.8
Rondog last edited by
The only way I can think of implementing this would be to subclass QPlainTextEdit and override the keypress events.
You can monitor for specific keys or key combinations and then use QApplication::postEvent() when you find something you want to use. All events captured in the derived class should be passed back to the base class otherwise it won't work as a text editor.
I am not sure if this is a good idea. You shouldn't use 'windows keys' on a Mac or, for that matter, OS X short cuts in Windows. OS X has it's own key shortcuts that can be used or changed if you don't like them; if your program creates it's own shortcut keys it will add confusion.