Important: Please read the Qt Code of Conduct -

[Close This] Shortcut Ctrl+C in a table behaves differently in Mac OSX than in Linux, Windows

  • On further investigation I find this behavior is in fact consistent across platforms. Not the behavior I expect (QShortCutContext of QWidgetShortCut does not restrict the shortcut to one widget), but not inconsistent as I thought.

    -Below is a small working PyQt4 program to demonstrate an inconsistency between Mac and other platforms. Excuse the length, it is as short as possible. When you run this code you get a nice window with an editor and a small table. The issue is with the Ctrl+C shortcut when the keyboard focus is in the table.-

    (program deleted)

  • In mac the copy keyboard shortcut is cmd+c instead of ctrl+c.

  • Of course it is. In Mac OS, one presses the CMD key and Qt normally delivers the Key_Control keypress and, on a following key, the ControlModifier mod. Exactly the same as pressing CONTROL and a key in Windows and Linux.

    I run this example (and the app it is derived from) on all three platforms and I am well aware of the key mappings. However perhaps I was not clear: when running the example in Mac OS, one presses CMD+C as one normally does. And then as I say, only the KeyControl keypress is delivered, and never the ControlModifier+C keypress.

    Note that for any Ctrl+X combination that is NOT defined as a shortCut to a menu, pressing CMD+X in mac delivers exactly the same as CTRL+X in the other platforms. The only difference is that in Mac, a shortcut such as Ctrl+C is not delivered.

Log in to reply