[Interest] QAction shortcuts in modal dialogs

John Weeks john at wavemetrics.com
Sat Apr 19 02:03:29 CEST 2014


Our application runs on Macintosh and Windows desktop systems. On Macintosh it is usual to have the menu bar active even when a modal dialog is displayed, and it can be used to cut/copy/paste in editable fields in the dialog.

Qt, on the other hand, uses the Windows convention of disabling the menu bar when a modal dialog is displayed.

First question: is it possible to override Qt's behavior on a Macintosh?

In Qt, to make the shortcuts for edit actions work, individual widgets like QLineEdit filter key press events looking for shortcut keystrokes. That makes it really difficult to change those shortcuts, should you choose to do so.

Second question: Do Qt widgets do it that way because QAction shortcuts don't work in a modal dialog?

We have a widget that we use in modal dialogs that should have edit actions available. It has a contextual menu, and that works- you can choose Copy from the contextual menu to copy from this widget. But adding a shortcut to that menu doesn't make the shortcut available. I'm guessing that the answer here is that we need to filter the key press events to implement shortcuts in modal dialogs. Is that correct?

Thank you!

-John Weeks




More information about the Interest mailing list