The way you describe it is actually how it works on Linux and Windows, but I can confirm that this does not work on macOS. I don’t know why the Qt developers decided that macOS should behave differently here. If this is a common UI pattern on macOS as well we could implement it.
To react to different key presses the corresponding widget class needs to override QtWidget.keyPressEvent
. For the two itemview columns this could be done in the BaseTreeView
in itemviews.py. For the file browser sidebar this is in filebrowser.py.
For manipulating the tree view the documentation in QTreeWidget Class | Qt Widgets 5.15.16 is relevant.
ESC already works on all platforms, this is default functionality for Qt dialogs. Command-Q would be special, but I don’t see this being supported on other tools on macOS. Is this common? I kind of find it difficult that hitting Command-Q twice will close immediately. If one wants to implement custom behavior here the QMessageBox
needs to be subclassed.
The Qt way