PySide.QtGui.QKeySequence class encapsulates a key sequence as used by shortcuts.
In its most common form, a key sequence describes a combination of keys that must be used together to perform some action. Key sequences are used with PySide.QtGui.QAction objects to specify which keyboard shortcuts can be used to trigger actions.
Key sequences can be constructed for use as keyboard shortcuts in three different ways:
例如, Ctrl P might be a sequence used as a shortcut for printing a document, and can be specified in any of the following ways:
QKeySequence(QKeySequence.Print)
QKeySequence(tr("Ctrl+P"))
QKeySequence(tr("Ctrl+p"))
QKeySequence(Qt.CTRL + Qt.Key_P)
Note that, for letters, the case used in the specification string does not matter. In the above examples, the user does not need to hold down the Shift key to activate a shortcut specified with “Ctrl+P”. 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. See the Keyboard Layout Issues section below for more details.
It is preferable to use standard shortcuts where possible. When creating key sequences for non-standard shortcuts, you should use human-readable strings in preference to hard-coded integer values.
PySide.QtGui.QKeySequence objects can be cast to a PySide.QtCore.QString to obtain a human-readable translated version of the sequence. Similarly, the PySide.QtGui.QKeySequence.toString() function produces human-readable strings for use in menus. On Mac OS X, the appropriate symbols are used to describe keyboard shortcuts using special keys on the Macintosh keyboard.
An 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 .
注意
On Mac OS X, references to “Ctrl”, Qt.CTRL , Qt::Control and Qt.ControlModifier correspond to the Command keys on the Macintosh keyboard, and references to “Meta”, Qt.META , Qt::Meta and Qt.MetaModifier correspond to the Control keys. Developers on Mac OS X can use the same shortcut descriptions across all platforms, and their applications will automatically work as expected on Mac OS X.
PySide.QtGui.QKeySequence defines many standard keyboard shortcuts to reduce the amount of effort required when setting up actions in a typical application. The table below shows some common key sequences that are often used for these standard shortcuts by applications on four widely-used platforms. Note that on Mac OS X, the Ctrl value corresponds to the Command keys on the Macintosh keyboard, and the Meta value corresponds to the Control keys.
| QKeySequence.StandardKey | Windows | Mac OS X | KDE | GNOME | S60 |
| HelpContents | F1 | Ctrl+? | F1 | F1 | F2 |
| WhatsThis | Shift+F1 | Shift+F1 | Shift+F1 | Shift+F1 | Shift+F1 |
| 打开 | Ctrl+O | Ctrl+O | Ctrl+O | Ctrl+O | (none) |
| Close | Ctrl+F4, Ctrl+W | Ctrl+W, Ctrl+F4 | Ctrl+W | Ctrl+W | (none) |
| Save | Ctrl+S | Ctrl+S | Ctrl+S | Ctrl+S | (none) |
| Quit | Ctrl+Q | Qtrl+Q | Qtrl+Q | (none) | |
| SaveAs | Ctrl+Shift+S | Ctrl+Shift+S | (none) | ||
| New | Ctrl+N | Ctrl+N | Ctrl+N | Ctrl+N | (none) |
| Delete | Del | Del, Meta+D | Del, Ctrl+D | Del, Ctrl+D | Del |
| Cut | Ctrl+X, Shift+Del | Ctrl+X | Ctrl+X, F20, Shift+Del | Ctrl+X, F20, Shift+Del | Ctrl+X |
| Copy | Ctrl+C, Ctrl+Ins | Ctrl+C | Ctrl+C, F16, Ctrl+Ins | Ctrl+C, F16, Ctrl+Ins | Ctrl+C |
| Paste | Ctrl+V, Shift+Ins | Ctrl+V | Ctrl+V, F18, Shift+Ins | Ctrl+V, F18, Shift+Ins | Ctrl+V |
| Preferences | Ctrl+, | (none) | |||
| Undo | Ctrl+Z, Alt+Backspace | Ctrl+Z | Ctrl+Z, F14 | Ctrl+Z, F14 | Ctrl+Z |
| Redo | Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace | Ctrl+Shift+Z | Ctrl+Shift+Z | Ctrl+Shift+Z | (none) |
| Back | Alt+Left, Backspace | Ctrl+[ | Alt+Left | Alt+Left | (none) |
| Forward | Alt+Right, Shift+Backspace | Ctrl+] | Alt+Right | Alt+Right | (none) |
| Refresh | F5 | F5 | F5 | Ctrl+R, F5 | (none) |
| ZoomIn | Ctrl+Plus | Ctrl+Plus | Ctrl+Plus | Ctrl+Plus | (none) |
| ZoomOut | Ctrl+Minus | Ctrl+Minus | Ctrl+Minus | Ctrl+Minus | (none) |
| Ctrl+P | Ctrl+P | Ctrl+P | Ctrl+P | (none) | |
| AddTab | Ctrl+T | Ctrl+T | Ctrl+Shift+N, Ctrl+T | Ctrl+T | (none) |
| NextChild | Ctrl+Tab, Forward, Ctrl+F6 | Ctrl+}, Forward, Ctrl+Tab | Ctrl+Tab, Forward, Ctrl+Comma | Ctrl+Tab, Forward | (none) |
| PreviousChild | Ctrl+Shift+Tab, Back, Ctrl+Shift+F6 | Ctrl+{, Back, Ctrl+Shift+Tab | Ctrl+Shift+Tab, Back, Ctrl+Period | Ctrl+Shift+Tab, Back | (none) |
| Find | Ctrl+F | Ctrl+F | Ctrl+F | Ctrl+F | (none) |
| FindNext | F3, Ctrl+G | Ctrl+G | F3 | Ctrl+G, F3 | (none) |
| FindPrevious | Shift+F3, Ctrl+Shift+G | Ctrl+Shift+G | Shift+F3 | Ctrl+Shift+G, Shift+F3 | (none) |
| Replace | Ctrl+H | (none) | Ctrl+R | Ctrl+H | (none) |
| SelectAll | Ctrl+A | Ctrl+A | Ctrl+A | Ctrl+A | (none) |
| Bold | Ctrl+B | Ctrl+B | Ctrl+B | Ctrl+B | (none) |
| Italic | Ctrl+I | Ctrl+I | Ctrl+I | Ctrl+I | (none) |
| Underline | Ctrl+U | Ctrl+U | Ctrl+U | Ctrl+U | (none) |
| MoveToNextChar | Right | Right | Right | Right | Right |
| MoveToPreviousChar | Left | Left | Left | Left | Left |
| MoveToNextWord | Ctrl+Right | Alt+Right | Ctrl+Right | Ctrl+Right | Ctrl+Right |
| MoveToPreviousWord | Ctrl+Left | Alt+Left | Ctrl+Left | Ctrl+Left | Ctrl+Left |
| MoveToNextLine | Down | Down | Down | Down | Down |
| MoveToPreviousLine | Up | Up | Up | Up | Up |
| MoveToNextPage | PgDown | PgDown, Alt+PgDown, Meta+Down, Meta+PgDown | PgDown | PgDown | PgDown |
| MoveToPreviousPage | PgUp | PgUp, Alt+PgUp, Meta+Up, Meta+PgUp | PgUp | PgUp | PgUp |
| MoveToStartOfLine | 首页 | Ctrl+Left, Meta+Left | 首页 | 首页 | 首页 |
| MoveToEndOfLine | End | Ctrl+Right, Meta+Right | End | End | End |
| MoveToStartOfBlock | (none) | Alt+Up, Meta+A | (none) | (none) | (none) |
| MoveToEndOfBlock | (none) | Alt+Down, Meta+E | (none) | (none) | (none) |
| MoveToStartOfDocument | Ctrl+Home | Ctrl+Up, Home | Ctrl+Home | Ctrl+Home | Ctrl+Home |
| MoveToEndOfDocument | Ctrl+End | Ctrl+Down, End | Ctrl+End | Ctrl+End | Ctrl+End |
| SelectNextChar | Shift+Right | Shift+Right | Shift+Right | Shift+Right | Shift+Right |
| SelectPreviousChar | Shift+Left | Shift+Left | Shift+Left | Shift+Left | Shift+Left |
| SelectNextWord | Ctrl+Shift+Right | Alt+Shift+Right | Ctrl+Shift+Right | Ctrl+Shift+Right | Ctrl+Shift+Right |
| SelectPreviousWord | Ctrl+Shift+Left | Alt+Shift+Left | Ctrl+Shift+Left | Ctrl+Shift+Left | Ctrl+Shift+Left |
| SelectNextLine | Shift+Down | Shift+Down | Shift+Down | Shift+Down | Shift+Down |
| SelectPreviousLine | Shift+Up | Shift+Up | Shift+Up | Shift+Up | Shift+Up |
| SelectNextPage | Shift+PgDown | Shift+PgDown | Shift+PgDown | Shift+PgDown | Shift+PgDown |
| SelectPreviousPage | Shift+PgUp | Shift+PgUp | Shift+PgUp | Shift+PgUp | Shift+PgUp |
| SelectStartOfLine | Shift+Home | Ctrl+Shift+Left | Shift+Home | Shift+Home | Shift+Home |
| SelectEndOfLine | Shift+End | Ctrl+Shift+Right | Shift+End | Shift+End | Shift+End |
| SelectStartOfBlock | (none) | Alt+Shift+Up, Meta+Shift+A | (none) | (none) | (none) |
| SelectEndOfBlock | (none) | Alt+Shift+Down, Meta+Shift+E | (none) | (none) | (none) |
| SelectStartOfDocument | Ctrl+Shift+Home | Ctrl+Shift+Up, Shift+Home | Ctrl+Shift+Home | Ctrl+Shift+Home | Ctrl+Shift+Home |
| SelectEndOfDocument | Ctrl+Shift+End | Ctrl+Shift+Down, Shift+End | Ctrl+Shift+End | Ctrl+Shift+End | Ctrl+Shift+End |
| DeleteStartOfWord | Ctrl+Backspace | Alt+Backspace | Ctrl+Backspace | Ctrl+Backspace | (none) |
| DeleteEndOfWord | Ctrl+Del | (none) | Ctrl+Del | Ctrl+Del | (none) |
| DeleteEndOfLine | (none) | (none) | Ctrl+K | Ctrl+K | (none) |
| InsertParagraphSeparator | Enter | Enter | Enter | Enter | (none) |
| InsertLineSeparator | Shift+Enter | Meta+Enter | Shift+Enter | Shift+Enter | (none) |
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.
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”). 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.
For 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. However, the way these shortcuts are specified and interpreted depends on the keyboard layout. Users of Norwegian keyboards will note that the + and - keys are not adjacent on the keyboard, but will still be able to activate both shortcuts without needing to press the Shift key. However, users with British keyboards will need to hold down the Shift key to enter the + symbol, making the shortcut effectively the same as “Ctrl+Shift+=”.
Although some developers might resort to fully specifying all the modifiers they use on their keyboards to activate a shortcut, this will also result in unexpected behavior for users of different keyboard layouts.
For example, a developer using a British keyboard may decide to specify “Ctrl+Shift+=” as the key sequence in order to create a shortcut that coincidentally behaves in the same way as Ctrl plus 。不管怎样, = key needs to be accessed using the Shift key on Norwegian keyboard, making the required shortcut effectively Ctrl Shift Shift = (an impossible key combination).
As a result, both human-readable strings and hard-coded key codes can both be problematic to use when specifying a key sequence that can be used on a variety of different keyboard layouts. Only the use of standard shortcuts guarantees that the user will be able to use the shortcuts that the developer intended.
Despite this, we can address this issue by ensuring that human-readable strings are used, making it possible for translations of key sequences to be made for users of different languages. This approach will be successful for users whose keyboards have the most typical layout for the language they are using.
Key sequences similar to those used in GNU Emacs , allowing up to four key codes, can be created by using the multiple argument constructor, or by passing a human-readable string of comma-separated key sequences.
例如,键序列, Ctrl X followed by Ctrl C , can be specified using either of the following ways:
QKeySequence(tr("Ctrl+X, Ctrl+C"))
QKeySequence(Qt.CTRL + Qt.Key_X, Qt.CTRL + Qt.Key_C)
警告
A PySide.QtGui.QApplication instance must have been constructed before a PySide.QtGui.QKeySequence is created; otherwise, your application may crash.
| 参数: |
|
|---|
构造空的键序列。
构造 PySide.QtGui.QKeySequence object for the given key . The result will depend on the currently running platform.
The resulting object will be based on the first element in the list of key bindings for the key .
Copy constructor. Makes a copy of keysequence .
创建键序列从 key string. For example “Ctrl+O” gives CTRL+'O'. The strings “Ctrl”, “Shift”, “Alt” and “Meta” are recognized, as well as their translated equivalents in the ” PySide.QtGui.QShortcut ” context (using QObject.tr() ).
Up to four key codes may be entered by separating them with commas, e.g. “Alt+X,Ctrl+S,Q”.
key should be in NativeText 格式。
This constructor is typically used with PySide.QtCore.QObject.tr() (), so that shortcut keys can be replaced in translations:
file = QMenu(self)
file.addAction(tr("&Open..."), self, SLOT("open()"),
QKeySequence(tr("Ctrl+O", "File|Open")))
Note the “File|Open” translator comment. It is by no means necessary, but it provides some context for the human translator.
创建键序列从 key string based on format .
Constructs a key sequence with up to 4 keys k1 , k2 , k3 and k4 .
The key codes are listed in Qt.Key and can be combined with modifiers (see Qt.Modifier ) such as Qt.SHIFT , Qt.CTRL , Qt.ALT ,或 Qt.META .
| 常量 | 描述 |
|---|---|
| QKeySequence.NativeText | The key sequence as a platform specific string. This means that it will be shown translated and on the Mac it will resemble a key sequence from the menu bar. This enum is best used when you want to display the string to the user. |
| QKeySequence.PortableText | The key sequence is given in a “portable” format, suitable for reading and writing to a file. In many cases, it will look similar to the native text on Windows and X11. |
This enum represent standard key bindings. They can be used to assign platform dependent keyboard shortcuts to a PySide.QtGui.QAction .
Note that the key bindings are platform dependent. The currently bound shortcuts can be queried using PySide.QtGui.QKeySequence.keyBindings() .
| 常量 | 描述 |
|---|---|
| QKeySequence.AddTab | Add new tab. |
| QKeySequence.Back | Navigate back. |
| QKeySequence.Bold | Bold text. |
| QKeySequence.Close | 关闭文档/选项卡。 |
| QKeySequence.Copy | 拷贝。 |
| QKeySequence.Cut | 剪切。 |
| QKeySequence.Delete | 删除。 |
| QKeySequence.DeleteEndOfLine | 删除行尾。 |
| QKeySequence.DeleteEndOfWord | Delete word from the end of the cursor. |
| QKeySequence.DeleteStartOfWord | Delete the beginning of a word up to the cursor. |
| QKeySequence.Find | Find in document. |
| QKeySequence.FindNext | 查找下一结果。 |
| QKeySequence.FindPrevious | 查找上一结果。 |
| QKeySequence.Forward | Navigate forward. |
| QKeySequence.HelpContents | 打开帮助内容。 |
| QKeySequence.InsertLineSeparator | Insert a new line. |
| QKeySequence.InsertParagraphSeparator | Insert a new paragraph. |
| QKeySequence.Italic | Italic text. |
| QKeySequence.MoveToEndOfBlock | Move cursor to end of block. This shortcut is only used on the OS X. |
| QKeySequence.MoveToEndOfDocument | Move cursor to end of document. |
| QKeySequence.MoveToEndOfLine | 移动光标到行尾。 |
| QKeySequence.MoveToNextChar | 移动光标到下一字符。 |
| QKeySequence.MoveToNextLine | 移动光标到下一行。 |
| QKeySequence.MoveToNextPage | 移动光标到下一页。 |
| QKeySequence.MoveToNextWord | 移动光标到下一单词。 |
| QKeySequence.MoveToPreviousChar | 移动光标到上一字符。 |
| QKeySequence.MoveToPreviousLine | 移动光标到上一行。 |
| QKeySequence.MoveToPreviousPage | 移动光标到上一页。 |
| QKeySequence.MoveToPreviousWord | Move cursor to previous word. |
| QKeySequence.MoveToStartOfBlock | Move cursor to start of a block. This shortcut is only used on OS X. |
| QKeySequence.MoveToStartOfDocument | Move cursor to start of document. |
| QKeySequence.MoveToStartOfLine | 移动光标到行起始。 |
| QKeySequence.New | 创建新文档。 |
| QKeySequence.NextChild | Navigate to next tab or child window. |
| QKeySequence.Open | 打开文档。 |
| QKeySequence.Paste | 粘贴。 |
| QKeySequence.Preferences | 打开首选项对话框。 |
| QKeySequence.PreviousChild | Navigate to previous tab or child window. |
| QKeySequence.Print | 打印文档。 |
| QKeySequence.Quit | 离开应用程序。 |
| QKeySequence.Redo | 重做。 |
| QKeySequence.Refresh | Refresh or reload current document. |
| QKeySequence.Replace | 查找并替换。 |
| QKeySequence.SaveAs | Save document after prompting the user for a file name. |
| QKeySequence.Save | 保存文档。 |
| QKeySequence.SelectAll | 选择所有文本。 |
| QKeySequence.SelectEndOfBlock | Extend selection to the end of a text block. This shortcut is only used on OS X. |
| QKeySequence.SelectEndOfDocument | Extend selection to end of document. |
| QKeySequence.SelectEndOfLine | Extend selection to end of line. |
| QKeySequence.SelectNextChar | Extend selection to next character. |
| QKeySequence.SelectNextLine | Extend selection to next line. |
| QKeySequence.SelectNextPage | Extend selection to next page. |
| QKeySequence.SelectNextWord | Extend selection to next word. |
| QKeySequence.SelectPreviousChar | Extend selection to previous character. |
| QKeySequence.SelectPreviousLine | Extend selection to previous line. |
| QKeySequence.SelectPreviousPage | Extend selection to previous page. |
| QKeySequence.SelectPreviousWord | Extend selection to previous word. |
| QKeySequence.SelectStartOfBlock | Extend selection to the start of a text block. This shortcut is only used on OS X. |
| QKeySequence.SelectStartOfDocument | Extend selection to start of document. |
| QKeySequence.SelectStartOfLine | Extend selection to start of line. |
| QKeySequence.Underline | 下划线文本。 |
| QKeySequence.Undo | 撤消。 |
| QKeySequence.UnknownKey | Unbound key. |
| QKeySequence.WhatsThis | Activate whats this. |
| QKeySequence.ZoomIn | 放大。 |
| QKeySequence.ZoomOut | 缩小。 |
| 常量 | 描述 |
|---|---|
| QKeySequence.NoMatch | The key sequences are different; not even partially matching. |
| QKeySequence.PartialMatch | The key sequences match partially, but are not the same. |
| QKeySequence.ExactMatch | The key sequences are the same. |
| 返回类型: | PyObject |
|---|
| 返回类型: | PyObject |
|---|
| 参数: | str – unicode |
|---|---|
| 返回类型: | PySide.QtCore.int |
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.int |
| 返回类型: | PySide.QtCore.uint |
|---|
Returns the number of keys in the key sequence. The maximum is 4.
| 参数: | ks – unicode |
|---|---|
| 返回类型: | PySide.QtCore.int |
| 参数: | key – PySide.QtCore.int |
|---|---|
| 返回类型: | unicode |
| 参数: |
|
|---|---|
| 返回类型: |
返回 PySide.QtGui.QKeySequence 从字符串 str 基于 format .
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if the key sequence is empty; otherwise returns false.
| 参数: | key – PySide.QtGui.QKeySequence.StandardKey |
|---|---|
| 返回类型: |
Returns a list of key bindings for the given key . The result of calling this function will vary based on the target platform. The first element of the list indicates the primary shortcut for the given platform. If the result contains more than one result, these can be considered alternative shortcuts on the same platform for the given key .
| 参数: | seq – PySide.QtGui.QKeySequence |
|---|---|
| 返回类型: | PySide.QtGui.QKeySequence.SequenceMatch |
Matches the sequence with seq 。返回 ExactMatch if successful, PartialMatch if seq matches incompletely, and NoMatch if the sequences have nothing in common. Returns NoMatch if seq is shorter.
| 参数: | text – unicode |
|---|---|
| 返回类型: | PySide.QtGui.QKeySequence |
Returns the shortcut key sequence for the mnemonic in text , or an empty key sequence if no mnemonics are found.
For example, mnemonic(“E&xit”) returns Qt::ALT+Qt::Key_X , mnemonic(“&Quit”) returns ALT+Key_Q , and mnemonic(“Quit”) returns an empty PySide.QtGui.QKeySequence .
We provide a list of common mnemonics in English. At the time of writing, Microsoft and Open Group do not appear to have issued equivalent recommendations for other languages.
另请参阅
qt_set_sequence_auto_mnemonic()
| 参数: | other – PySide.QtGui.QKeySequence |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if this key sequence is not equal to the other key sequence; otherwise returns false.
| 参数: | ks – PySide.QtGui.QKeySequence |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Provides an arbitrary comparison of this key sequence and other key sequence. All that is guaranteed is that the operator returns false if both key sequences are equal and that (ks1 < ks2) == !( ks2 < ks1) if the key sequences are not equal.
This function is useful in some circumstances, for example if you want to use PySide.QtGui.QKeySequence objects as keys in a QMap .
另请参阅
PySide.QtGui.QKeySequence.operator==() PySide.QtGui.QKeySequence.operator!=() PySide.QtGui.QKeySequence.operator>() PySide.QtGui.QKeySequence.operator<=() PySide.QtGui.QKeySequence.operator>=()
| 参数: | other – PySide.QtGui.QKeySequence |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if this key sequence is smaller or equal to the other key sequence; otherwise returns false.
另请参阅
PySide.QtGui.QKeySequence.operator==() PySide.QtGui.QKeySequence.operator!=() PySide.QtGui.QKeySequence.operator<() PySide.QtGui.QKeySequence.operator>() PySide.QtGui.QKeySequence.operator>=()
| 参数: | other – PySide.QtGui.QKeySequence |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if this key sequence is equal to the other key sequence; otherwise returns false.
| 参数: | other – PySide.QtGui.QKeySequence |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if this key sequence is larger than the other key sequence; otherwise returns false.
另请参阅
PySide.QtGui.QKeySequence.operator==() PySide.QtGui.QKeySequence.operator!=() PySide.QtGui.QKeySequence.operator<() PySide.QtGui.QKeySequence.operator<=() PySide.QtGui.QKeySequence.operator>=()
| 参数: | other – PySide.QtGui.QKeySequence |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if this key sequence is larger or equal to the other key sequence; otherwise returns false.
另请参阅
PySide.QtGui.QKeySequence.operator==() PySide.QtGui.QKeySequence.operator!=() PySide.QtGui.QKeySequence.operator<() PySide.QtGui.QKeySequence.operator>() PySide.QtGui.QKeySequence.operator<=()
| 参数: |
|
|---|
| 参数: | other – PySide.QtGui.QKeySequence |
|---|
Swaps key sequence other with this key sequence. This operation is very fast and never fails.
| 参数: | format – PySide.QtGui.QKeySequence.SequenceFormat |
|---|---|
| 返回类型: | unicode |
Return a string representation of the key sequence, based on format .
For example, the value Qt.CTRL + Qt.Key_O results in “Ctrl+O”. If the key sequence has multiple key codes, each is separated by commas in the string returned, such as “Alt+X, Ctrl+Y, Z”. The strings, “Ctrl”, “Shift”, etc. are translated using QObject.tr() in the ” PySide.QtGui.QShortcut ” context.
If the key sequence has no keys, an empty string is returned.
On Mac OS X, the string returned resembles the sequence that is shown in the menu bar.