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 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. Print ) QKeySequence ( tr ( "Ctrl+P" )) QKeySequence ( tr ( "Ctrl+p" )) QKeySequence ( Qt. į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: Each key code consists of a single Key value and zero or more modifiers, such as SHIFT, CTRL, ALT and META. ![]() ![]() Translations are made in the “ QShortcut “ context.įor hard-coded shortcuts, integer key codes can be specified with a combination of values defined by the Key and Modifier enum values. Key sequences can be constructed for use as keyboard shortcuts in three different ways:įor standard shortcuts, a standard key can be used to request the platform-specific key sequence associated with each shortcut.įor custom shortcuts, human-readable strings such as “Ctrl+X” can be used, and these can be translated into the appropriate shortcuts for users of different languages. Key sequences are used with QAction objects to specify which keyboard shortcuts can be used to trigger actions. In its most common form, a key sequence describes a combination of keys that must be used together to perform some action.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |