class KShortcut

# class KShortcut |
Definition | `#include <kshortcut.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum { MAX_SEQUENCES = 2 }

#### Public Methods

- KShortcut ()
- KShortcut ( int keyQt )
- KShortcut ( const QKeySequence& keySeq )
- KShortcut ( const KKey& key )
- KShortcut ( const KKeySequence& keySeq )
- KShortcut ( const KShortcut& shortcut )
- KShortcut ( const char* shortcut )
- KShortcut ( const QString& shortcut )
- ~KShortcut ()
- void clear ()
- bool init ( int keyQt )
- bool init ( const QKeySequence& keySeq )
- bool init ( const KKey& key )
- bool init ( const KKeySequence& keySeq )
- bool init ( const KShortcut& shortcut )
- bool init ( const QString& shortcut )
- KShortcut& operator = ( const KShortcut& cut )
- uint count () const
- const KKeySequence& seq ( uint i ) const
- int keyCodeQt () const
- bool isNull () const
- int compare ( const KShortcut& shortcut ) const
- bool operator == ( const KShortcut& cut ) const
- bool operator != ( const KShortcut& cut ) const
- bool operator < ( const KShortcut& cut ) const
- bool contains ( const KKey& key ) const
- bool contains ( const KKeyNative& key ) const
- bool contains ( const KKeySequence& keySeq ) const
- bool setSeq ( uint i, const KKeySequence& keySeq )
- bool append ( const KKeySequence& keySeq )
- operator QKeySequence () const
- QString toString () const
- QString toStringInternal ( const KShortcut* pcutDefault = 0 ) const
- operator int () const

#### Public Static Methods

- static KShortcut& null ()

#### Protected Members

- uint m_nSeqs
- KKeySequence m_rgseq[MAX_SEQUENCES]

## Detailed Description

enum { MAX_SEQUENCES = 2 } | ###

The maximum number of key sequences that can be contained in a KShortcut.

KShortcut () | ### KShortcut

Creates a new null shortcut.

See also: null(), isNull(), clear()

KShortcut ( int keyQt ) | ### KShortcut

Creates a new shortcut with the given Qt key code as the only key sequence.

Parameters:

keyQt | the qt keycode

See also: Qt::Key

KShortcut ( const QKeySequence& keySeq ) | ### KShortcut

Creates a new shortcut that contains only the given qt key sequence.

Parameters:

keySeq | the qt key sequence to add

KShortcut ( const KKey& key ) | ### KShortcut

Creates a new shortcut that contains only the given key in its only sequence.

Parameters:

key | the key to add

KShortcut ( const KKeySequence& keySeq ) | ### KShortcut

Creates a new shortcut that contains only the given key sequence.

Parameters:

keySeq | the key sequence to add

KShortcut ( const KShortcut& shortcut ) | ### KShortcut

Copies the given shortcut.

Parameters:

shortcut | the shortcut to add

KShortcut ( const char* shortcut ) | ### KShortcut

Creates a new key sequence that contains the given key sequence. The description consists of semicolon-separated keys as used in KKeySequence::KKeySequence(const QString&).

Parameters:

shortcut | the description of the key

See also: KKeySequence::KKeySequence(const, QString&)

KShortcut ( const QString& shortcut ) | ### KShortcut

Creates a new key sequence that contains the given key sequence. The description consists of semicolon-separated keys as used in KKeySequence::KKeySequence(const QString&).

Parameters:

shortcut | the description of the key

See also: KKeySequence::KKeySequence(const, QString&)

~KShortcut () | ### ~KShortcut

void clear () | ### clear

Clears the shortcut. The shortcut is null after calling this function.

See also: isNull()

bool init ( int keyQt ) | ### init

Initializes the shortcut with the given Qt key code as the only key sequence.

Parameters:

keyQt | the qt keycode

See also: Qt::Key

bool init ( const QKeySequence& keySeq ) | ### init

Initializes the shortcut with the given qt key sequence.

Parameters:

keySeq | the qt key sequence to add

bool init ( const KKey& key ) | ### init

Initializes the shortcut with the given key as its only sequence.

Parameters:

key | the key to add

bool init ( const KKeySequence& keySeq ) | ### init

Initializes the shortcut with the given qt key sequence.

Parameters:

keySeq | the qt key sequence to add

bool init ( const KShortcut& shortcut ) | ### init

Copies the given shortcut.

Parameters:

shortcut | the shortcut to add

bool init ( const QString& shortcut ) | ### init

Initializes the key sequence with the given key sequence. The description consists of semicolon-separated keys as used in KKeySequence::KKeySequence(const QString&).

Parameters:

shortcut | the description of the key

See also: KKeySequence::KKeySequence(const, QString&)

KShortcut& operator = ( const KShortcut& cut ) | ### operator =

Copies the given shortcut over this shortcut.

uint count () | ### count

[const]

Returns the number of sequences that are in this shortcut.

Returns: the number of sequences MAX_SEQUENCES

const KKeySequence& seq ( uint i ) | ### seq

[const]

Returns the `i`'th key sequence of this shortcut.

Parameters:

i | the number of the key sequence to retrieve

Returns: the `i`'th sequence or KKeySequence::null() if there are less than `i` key sequences MAX_SEQUENCES

int keyCodeQt () | ### keyCodeQt

[const]

Returns the key code of the first key sequence, or null if there is no first key sequence.

Returns: the key code of the first sequence's first key

See also: Qt::Key, KKeySequence::keyCodeQt()

bool isNull () | ### isNull

[const]

Returns true if the shortcut is null (after clear() or empty constructor).

Returns: true if the shortcut is null

See also: clear(), null()

int compare ( const KShortcut& shortcut ) | ### compare

[const]

Compares this object with the given shortcut. Returns a negative number if the given shortcut is larger, 0 if they are equal and a positive number this shortcut is larger. Shortcuts are compared by comparing the individual key sequences, starting from the beginning until an unequal key sequences has been found. If a shortcut contains more key sequences, it is considered larger.

Parameters:

shortcut | the shortcut to compare to

Returns: a negative number if the given KShortcut is larger, 0 if they are equal and a positive number this KShortcut is larger

See also: KKey::compare(), KKeyShortcut::compare()

bool operator == ( const KShortcut& cut ) | ### operator ==

[const]

Compares the sequences of both shortcuts.

See also: compare()

bool operator != ( const KShortcut& cut ) | ### operator !=

[const]

Compares the sequences of both shortcuts.

See also: compare()

bool operator < ( const KShortcut& cut ) | ### operator <

[const]

Compares the sequences of both shortcuts.

See also: compare()

bool contains ( const KKey& key ) | ### contains

[const]

Checks whether this shortcut contains a sequence that starts with the given key.

Parameters:

key | the key to check

Returns: true if a key sequence starts with the key

bool contains ( const KKeyNative& key ) | ### contains

[const]

Checks whether this shortcut contains a sequence that starts with the given key.

Parameters:

key | the key to check

Returns: true if a key sequence starts with the key

bool contains ( const KKeySequence& keySeq ) | ### contains

[const]

Checks whether this shortcut contains the given sequence.

Parameters:

keySeq | the key sequence to check

Returns: true if the shortcut has the given key sequence

bool setSeq ( uint i, const KKeySequence& keySeq ) | ### setSeq

Sets the `i`'th key sequence of the shortcut. You can not introduce gaps in the list of sequences, so you must use an @i <= count(). Also note that the maximum number of key sequences is MAX_SEQUENCES.

Parameters:

i | the position of the new key sequence(<= count(), <= MAX_SEQUENCES)
keySeq | the key sequence to set

Returns: true if successful, false otherwise

bool append ( const KKeySequence& keySeq ) | ### append

Appends the given key sequence.

Parameters:

keySeq | the key sequence to add

Returns: true if successful, false otherwise

See also: setSeq(), MAX_SEQUENCES

operator QKeySequence () | ### QKeySequence

[const]

Converts this shortcut to a key sequence. The first key sequence will be taken.

QString toString () | ### toString

[const]

Returns a description of the shortcut as semicolon-separated ket sequences, as returned by KKeySequence::toString().

Returns: the string represenation of this shortcut

See also: KKey::toString(), KKeySequence::toString()

QString toStringInternal ( const KShortcut* pcutDefault = 0 ) | ### toStringInternal

[const]

KShortcut& null () | ### null

[static]

Returns a null shortcut.

Returns: the null shortcut

See also: isNull(), clear()

uint m_nSeqs | ### m_nSeqs

[protected]

KKeySequence m_rgseq[MAX_SEQUENCES] | ### m_rgseq[MAX_SEQUENCES]

[protected]

operator int () | ### int

[const]

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:15 2003, using kdoc 2.0a54.