KDECore
KKeySequence Class Reference
A KKeySequence object holds a sequence of up to 4 keys. More...
#include <kshortcut.h>
Public Types | |
enum | { MAX_KEYS = 4 } |
Public Member Functions | |
void | clear () |
int | compare (const KKeySequence &keySeq) const |
uint | count () const |
bool | init (const QString &key) |
bool | init (const KKeySequence &keySeq) |
bool | init (const KKeyNative &key) |
bool | init (const KKey &key) |
bool | init (const QKeySequence &keySeq) |
bool | isNull () const |
bool | isTriggerOnRelease () const |
const KKey & | key (uint i) const |
int | keyCodeQt () const |
KKeySequence (const QString &keySeq) | |
KKeySequence (const KKeySequence &keySeq) | |
KKeySequence (const KKeyNative &key) | |
KKeySequence (const KKey &key) | |
KKeySequence (const QKeySequence &keySeq) | |
KKeySequence () | |
bool | operator!= (const KKeySequence &seq) const |
bool | operator< (const KKeySequence &seq) const |
KKeySequence & | operator= (const KKeySequence &seq) |
bool | operator== (const KKeySequence &seq) const |
QKeySequence | qt () const |
bool | setKey (uint i, const KKey &key) |
bool | startsWith (const KKeySequence &keySeq) const |
QString | toString () const |
QString | toStringInternal () const |
~KKeySequence () | |
Static Public Member Functions | |
static KKeySequence & | null () |
Protected Attributes | |
uchar | m_bTriggerOnRelease |
uchar | m_nKeys |
KKey | m_rgvar [MAX_KEYS] |
Detailed Description
A KKeySequence object holds a sequence of up to 4 keys.Ex: Ctrl+X,I
Definition at line 288 of file kshortcut.h.
Member Enumeration Documentation
anonymous enum |
Constructor & Destructor Documentation
KKeySequence::KKeySequence | ( | ) |
KKeySequence::KKeySequence | ( | const QKeySequence & | keySeq | ) |
Copies the given qt key sequence.
- Parameters:
-
keySeq the qt key sequence to copy
Definition at line 211 of file kshortcut.cpp.
KKeySequence::KKeySequence | ( | const KKey & | key | ) |
Create a new key sequence that only contains the given key.
- Parameters:
-
key the key to add
Definition at line 212 of file kshortcut.cpp.
KKeySequence::KKeySequence | ( | const KKeyNative & | key | ) |
Create a new key sequence that only contains the given key.
- Parameters:
-
key the key to add
KKeySequence::KKeySequence | ( | const KKeySequence & | keySeq | ) |
Copies the given key sequence.
- Parameters:
-
keySeq the key sequence to copy
Definition at line 213 of file kshortcut.cpp.
KKeySequence::KKeySequence | ( | const QString & | keySeq | ) |
Creates a new key sequence that contains the given key sequence.
The description consists of comma-separated keys as required by KKey::KKey(const QString&).
- Parameters:
-
keySeq the description of the key
Definition at line 214 of file kshortcut.cpp.
KKeySequence::~KKeySequence | ( | ) |
Definition at line 216 of file kshortcut.cpp.
Member Function Documentation
void KKeySequence::clear | ( | ) |
Clears the key sequence.
The key sequence is null after calling this function.
- See also:
- isNull()
Definition at line 220 of file kshortcut.cpp.
int KKeySequence::compare | ( | const KKeySequence & | keySeq | ) | const |
Compares this object with the given key sequence.
Returns a negative number if the given KKeySequence is larger, 0 if they are equal and a positive number this KKeySequence is larger. Key sequences are compared by comparing the individual keys, starting from the beginning until an unequal key has been found. If a sequence contains more keys, it is considered larger.
- Parameters:
-
keySeq the key sequence to compare to
- Returns:
- a negative number if the given KKeySequence is larger, 0 if they are equal and a positive number this KKeySequence is larger
- See also:
- KKey::sequence
Definition at line 333 of file kshortcut.cpp.
uint KKeySequence::count | ( | ) | const |
Returns the number of key strokes of this sequence.
- Returns:
- the number of key strokes
- See also:
- MAX_KEYS
Definition at line 288 of file kshortcut.cpp.
Initializes this key sequence to contain the given key sequence.
The description consists of comma-separated keys as required by KKey::KKey(const QString&).
- Parameters:
-
key the description of the key
- Returns:
- true if successful, false otherwise
Definition at line 267 of file kshortcut.cpp.
bool KKeySequence::init | ( | const KKeySequence & | keySeq | ) |
Copies the given key sequence over this key sequence.
- Parameters:
-
keySeq the key sequence to copy
- Returns:
- true if successful, false otherwise
Definition at line 252 of file kshortcut.cpp.
bool KKeySequence::init | ( | const KKeyNative & | key | ) |
Initializes the key sequence to only contain the given key.
- Parameters:
-
key the key to set
- Returns:
- true if successful, false otherwise
Initializes the key sequence to only contain the given key.
- Parameters:
-
key the key to set
- Returns:
- true if successful, false otherwise
Definition at line 241 of file kshortcut.cpp.
bool KKeySequence::init | ( | const QKeySequence & | keySeq | ) |
Copies the given qt key sequence over this key sequence.
- Parameters:
-
keySeq the qt key sequence to copy
- Returns:
- true if successful, false otherwise
Definition at line 226 of file kshortcut.cpp.
bool KKeySequence::isNull | ( | ) | const |
Returns true if the key sequence is null (after clear() or empty constructor).
- Returns:
- true if the key sequence is null
Definition at line 315 of file kshortcut.cpp.
bool KKeySequence::isTriggerOnRelease | ( | ) | const |
const KKey & KKeySequence::key | ( | uint | i | ) | const |
Return the i'th
key of this sequence, or a null key if there are less then i keys.
- Parameters:
-
i the key to retrieve
- Returns:
- the
i'th
key, or KKey::null() if there are less than i keys
- See also:
- MAX_KEYS
Definition at line 293 of file kshortcut.cpp.
int KKeySequence::keyCodeQt | ( | ) | const |
Returns the qt key code of the first key.
- Returns:
- the qt key code of the first key
- See also:
- Qt::Key
Definition at line 356 of file kshortcut.cpp.
KKeySequence & KKeySequence::null | ( | ) | [static] |
Returns a null key sequence.
- Returns:
- the null key sequence
Definition at line 389 of file kshortcut.cpp.
bool KKeySequence::operator!= | ( | const KKeySequence & | seq | ) | const [inline] |
bool KKeySequence::operator< | ( | const KKeySequence & | seq | ) | const [inline] |
KKeySequence& KKeySequence::operator= | ( | const KKeySequence & | seq | ) | [inline] |
bool KKeySequence::operator== | ( | const KKeySequence & | seq | ) | const [inline] |
QKeySequence KKeySequence::qt | ( | ) | const |
Converts this key sequence to a QKeySequence.
- Returns:
- the QKeySequence
Definition at line 346 of file kshortcut.cpp.
Sets the i'th
key of the sequence.
You can not introduce gaps in a sequence, so you must use an i
<= count(). Also note that the maximum length of a key sequence is MAX_KEYS.
- Parameters:
-
i the position of the new key (<= count(), <= MAX_KEYS) key the key to set
- Returns:
- true if successful, false otherwise
Definition at line 304 of file kshortcut.cpp.
bool KKeySequence::startsWith | ( | const KKeySequence & | keySeq | ) | const |
Returns true if this key sequence begins with the given sequence.
- Parameters:
-
keySeq the key sequence to search
- Returns:
- true if this key sequence begins with the given sequence
Definition at line 320 of file kshortcut.cpp.
QString KKeySequence::toString | ( | ) | const |
Returns the key sequence as a number of key presses as returned by KKey::toString(), separated by commas.
- Returns:
- the string represenation of this key sequence
- See also:
- KKey::toString()
Definition at line 361 of file kshortcut.cpp.
QString KKeySequence::toStringInternal | ( | ) | const |
Member Data Documentation
uchar KKeySequence::m_bTriggerOnRelease [protected] |
Definition at line 511 of file kshortcut.h.
uchar KKeySequence::m_nKeys [protected] |
Definition at line 510 of file kshortcut.h.
KKey KKeySequence::m_rgvar[MAX_KEYS] [protected] |
Definition at line 513 of file kshortcut.h.
The documentation for this class was generated from the following files: