![]() Additionally, because certain symbols can only be entered with the help of modifier keys on certain keyboard layouts, key sequences intended for use with one keyboard layout may map to a different key, map to no keys at all, or require an additional modifier key to be used on different keyboard layouts.įor example, the shortcuts, Ctrl plus and Ctrl minus, are often used as shortcuts for zoom operations in graphics applications, and these may be specified as "Ctrl++" and "Ctrl+-" respectively. Many key sequence specifications are chosen by developers based on the layout of certain types of keyboard, rather than choosing keys that represent the first letter of an action's name, such as Ctrl S ("Ctrl+S") or Ctrl C ("Ctrl+C"). Note that, since the key sequences used for the standard shortcuts differ between platforms, you still need to test your shortcuts on each platform to ensure that you do not unintentionally assign the same key sequence to many actions. PgDown, Alt+PgDown, Meta+Down, Meta+PgDown, Meta+V 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.Ĭtrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace 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. QKeySequence(Qt::CTRL + Qt::Key_P) // deprecated 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: For hard-coded shortcuts, integer key codes can be specified with a combination of values defined by the Qt::Key and Qt::Modifier enum values.Translations are made in the " QShortcut" context. For 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.For standard shortcuts, a standard key can be used to request the platform-specific key sequence associated with each shortcut.Key sequences can be constructed for use as keyboard shortcuts in three different ways: 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. Operator>=(const QKeySequence & other) const Operator(const QKeySequence & other) const Operator!=(const QKeySequence & other) const ToString(QKeySequence::SequenceFormat format = PortableText) const QKeySequence(const QString & key, QKeySequence::SequenceFormat format = NativeText) QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0) QKeySequence(QKe圜ombination k1, QKe圜ombination k2 = QKe圜ombination::fromCombined(0), QKe圜ombination k3 = QKe圜ombination::fromCombined(0), QKe圜ombination k4 = QKe圜ombination::fromCombined(0)) QKeySequence(const QKeySequence & keysequence) QKeySequence(QKeySequence::StandardKey key)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |