Developers on macOS can use the same shortcut descriptions across all platforms, and their applications will automatically work as expected on macOS. Note: On macOS, references to "Ctrl", Qt::CTRL, Qt::Key_Control and Qt::ControlModifier correspond to the Command keys on the Macintosh keyboard, and references to "Meta", Qt::META, Qt::Key_Meta and Qt::MetaModifier correspond to the Control keys. On macOS, the appropriate symbols are used to describe keyboard shortcuts using special keys on the Macintosh keyboard.Īn alternative way to specify hard-coded key codes is to use the Unicode code point of the character for example, 'A' gives the same key sequence as Qt::Key_A. Similarly, the toString() function produces human-readable strings for use in menus. QKeySequence objects can be cast to a QString to obtain a human-readable translated version of the sequence. When creating key sequences for non-standard shortcuts, you should use human-readable strings in preference to hard-coded integer values. It is preferable to use standard shortcuts where possible. See the Keyboard Layout Issues section below for more details. However, for other keys, the use of Shift as an unspecified extra modifier key can lead to confusion for users of an application whose keyboards have different layouts to those used by the developers. In the above examples, the user does not need to hold down the Shift key to activate a shortcut specified with "Ctrl+P". Note that, for letters, the case used in the specification string does not matter. Each key code consists of a single Qt::Key value and zero or more modifiers, such as Qt::SHIFT, Qt::CTRL, Qt::ALT and Qt::META.įor example, Ctrl P might be a sequence used as a shortcut for printing a document, and can be specified in any of the following ways:
Translations are made in the " QShortcut" context.