class KShortcut |
|
Represents a keyboard shortcut
The KShortcut class is used to represent a keyboard shortcut to an action. A shortcut is normally a single key with modifiers, such as Ctrl+V. A KShortcut object may also contain an alternate key sequence which will also activate the action it's associated with, as long as no other actions have defined that key as their primary key. Ex: Ctrl+V;Shift+Insert. This can be used to add additional accelerators to a KAction. For example, the below code binds the escape key to the close action.
KAction *closeAction = KStandardAction.close(this, SLOT( close() ), actionCollection()); KShortcut closeShortcut = closeAction->shortcut(); closeShortcut.setAlternate(Qt.Key_Escape); closeAction->setShortcut(closeShortcut); |
|
Creates a new empty shortcut.
See also isEmpty() See also clear() |
|
Creates a new shortcut that contains the given Qt key
sequence as primary shortcut.
primary - Qt key sequence to add |
|
Creates a new shortcut with the given Qt key sequences
as primary and secondary shortcuts.
primary - Qt keycode of primary shortcut alternate - Qt keycode of alternate shortcut See also Qt.Key |
|
Creates a new shortcut with the given Qt key codes
as primary and secondary shortcuts.
You can only assign single-key shortcuts this way.
keyQtPri - Qt keycode of primary shortcut keyQtAlt - Qt keycode of alternate shortcut See also Qt.Key |
|
Copy constructor. |
|
Creates a new shortcut that contains the key sequences described
in description. The format of description is the same as
used in QKeySequence.fromString(const QString&).
Up to two key sequences separated by a semicolon followed by a
space "; " may be given.
description - the description of key sequence(s) See also QKeySequence.fromString(const QString&, SequenceFormat) |
|
Creates a new shortcut with the given Qt key sequences.
The first sequence in the list is considered to be the primary
sequence, the second one the alternate.
seqs - List of key sequeces. |
|
|
|
|
|
Returns the alternate key sequence of this shortcut. Returns alternate key sequence |
|
Returns whether at least one of the key sequences is equal to needle. Returns whether this shortcut contains needle |
|
Returns whether this shortcut contains any nonempty key sequences. Returns whether this shortcut is empty |
|
|
|
Returns the primary key sequence of this shortcut. Returns primary key sequence |
|
Remove keySeq from this shortcut.
If handleEmpty equals RemoveEmpty, following key sequences will move up to take the place of
keySeq. Otherwise, key sequences equal to keySeq will be set to empty.
keySeq - remove this key sequence from the shortcut |
|
Set the alternate key sequence of this shortcut to the given key sequence.
keySeq - set alternate key sequence to this |
|
Set the primary key sequence of this shortcut to the given key sequence.
keySeq - set primary key sequence to this |
|
The same as operator QList\ |
|
Returns a description of the shortcut as a semicolon-separated
list of key sequences, as returned by QKeySequence.toString().
Returns the string represenation of this shortcut
See also QKeySequence.toString() See also KShortcut(const QString &description) |
if a shortcut is or becomes empty, let it stay as a placeholder
KeepEmpty | - 0 | - | ||
RemoveEmpty | - | - |