KKey Class Reference
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win). More...
#include <kshortcut.h>
Public Types | |
enum | { MOD_FLAG_COUNT = 4 } |
enum | { QtWIN = (Qt::META) } |
enum | ModFlag { SHIFT = 0x01, CTRL = 0x02, ALT = 0x04, WIN = 0x08 } |
Public Member Functions | |
KKey () | |
KKey (int keyQt) | |
KKey (const QKeySequence &keySeq) | |
KKey (const QKeyEvent *keyEvent) | |
KKey (const KKey &key) | |
KKey (const QString &key) | |
KKey (uint key, uint mod) | |
void | clear () |
bool | init (int keyQt) |
bool | init (const QKeySequence &keySeq) |
bool | init (const QKeyEvent *keyEvent) |
bool | init (const KKey &key) |
bool | init (const QString &key) |
bool | init (uint key, uint mod) |
KKey & | operator= (const KKey &key) |
bool | isNull () const |
uint | sym () const |
uint | modFlags () const |
int | compare (const KKey &key) const |
bool | operator== (const KKey &key) const |
bool | operator!= (const KKey &key) const |
bool | operator< (const KKey &key) const |
int | keyCodeQt () const |
QString | toString () const |
QString | toStringInternal () const |
void | simplify () |
Static Public Member Functions | |
KKey & | null () |
QString | modFlagLabel (ModFlag f) |
Friends | |
class | KKeyNative |
Detailed Description
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).It can represent both keys which are understood by Qt as well as those which are additionally supported by the underlying system (e.g. X11).
- See also:
- KKeyNative
Definition at line 39 of file kshortcut.h.
Member Enumeration Documentation
|
The number of flags.
Definition at line 46 of file kshortcut.h. |
|
Flags to represent the modifiers. You can combine modifiers by ORing them. Definition at line 52 of file kshortcut.h. |
Constructor & Destructor Documentation
|
Creates a new null KKey.
Definition at line 44 of file kshortcut.cpp. References clear(). |
|
Creates a new key for the given Qt key code.
Definition at line 46 of file kshortcut.cpp. References init(). |
|
Creates a new key from the first key code of the given key sequence.
Definition at line 47 of file kshortcut.cpp. References init(). |
|
Extracts the key from the given key event.
Definition at line 48 of file kshortcut.cpp. References init(). |
|
Copy constructor.
Definition at line 49 of file kshortcut.cpp. References init(). |
|
Creates a new key from the given description. The form of the description is "[modifier+[modifier+]]+key", for example "e", "CTRL+q" or "CTRL+ALT+DEL". Allowed modifiers are "SHIFT", "CTRL", "ALT", "WIN" and "META". "WIN" and "META" are equivalent. Modifiers are not case-sensitive.
Definition at line 50 of file kshortcut.cpp. References init(). |
Member Function Documentation
|
Clears the key. The key is null after calling this function.
Definition at line 56 of file kshortcut.cpp. |
|
Initializes the key with the given Qt key code.
Definition at line 69 of file kshortcut.cpp. References KKeyServer::keyQtToMod(), and KKeyServer::keyQtToSym(). Referenced by KKeySequence::init(), init(), KKey(), operator=(), and KKeySequence::setKey(). |
|
Initializes the key with the first key code of the given key sequence.
Definition at line 84 of file kshortcut.cpp. References init(). |
|
Initializes the key by extracting the code from the given key event.
Definition at line 90 of file kshortcut.cpp. References init(). |
|
Copies the given key.
Definition at line 100 of file kshortcut.cpp. |
|
Initializes the key with the given description. The form of the description is "[modifier+[modifier+]]+key", for example "e", "CTRL+q" or "CTRL+ALT+DEL". Allowed modifiers are "SHIFT", "CTRL", "ALT", "WIN" and "META". "WIN" and "META" are equivalent. Modifiers are not case-sensitive.
Definition at line 107 of file kshortcut.cpp. References clear(), endl(), and KKeyServer::Sym::m_sym. |
|
Copies the key.
Definition at line 161 of file kshortcut.h. References init(). |
|
Returns true if the key is null (after clear() or empty constructor).
Definition at line 146 of file kshortcut.cpp. Referenced by KKeySequence::init(), and null(). |
|
Compares this key with the given KKey object. Returns a negative number if the given KKey is larger, 0 if they are equal and a positive number this KKey is larger. The returned value is the difference between the symbol or, if the symbols are equal, the difference between the encoded modifiers.
Definition at line 150 of file kshortcut.cpp. Referenced by KKeySequence::compare(), operator!=(), operator<(), and operator==(). |
|
Compares the symbol and modifiers of both keys.
Definition at line 200 of file kshortcut.h. References compare(). |
|
Compares the symbol and modifiers of both keys.
Definition at line 206 of file kshortcut.h. References compare(). |
|
Compares the symbol and modifiers of both keys.
Definition at line 212 of file kshortcut.h. References compare(). |
|
Returns the qt key code.
Definition at line 159 of file kshortcut.cpp. |
|
Returns a human-readable representation of the key in the form "modifier+key". Note that the representation is localised, use toStringInternal() for cases like saving to configuration files.
Definition at line 164 of file kshortcut.cpp. References KKeyServer::modToStringUser(). Referenced by KKeySequence::toString(). |
|
Returns an untranslated text representation of the key in the form "modifier+key", suitable e.g. for saving in configuration files. Definition at line 176 of file kshortcut.cpp. |
|
Returns a null key.
Definition at line 190 of file kshortcut.cpp. References clear(), and isNull(). Referenced by KKeySequence::key(). |
|
Returns a user-readable representation of the given modifiers.
Definition at line 199 of file kshortcut.cpp. References KKeyServer::modToStringUser(). |
The documentation for this class was generated from the following files: