class KKey

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

#### Public Types

- enum { MOD_FLAG_COUNT = 4 }
- enum { QtWIN = (Qt::ALT << 1) }
- enum ModFlag { SHIFT = 0x01, CTRL = 0x02, ALT = 0x04, WIN = 0x08 }

#### Public Methods

- 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 )
- ~KKey ()
- 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& )
- bool init ( uint key, uint mod )
- KKey& operator = ( const KKey& key )
- bool isNull () const
- bool isValidQt () const
- bool isValidNative () 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 ()

#### Public Static Methods

- static KKey& null ()
- static QString modFlagLabel ( ModFlag f )

#### Public Members

- uint m_sym
- uint m_mod

## Detailed Description

enum { MOD_FLAG_COUNT = 4 } | ###

The number of flags.

See also: ModFlag

enum { QtWIN = (Qt::ALT << 1) } | ###

enum ModFlag { SHIFT = 0x01, CTRL = 0x02, ALT = 0x04, WIN = 0x08 } | ### ModFlag

Flags to represent the modifiers. You can combine modifiers by ORing them.

KKey () | ### KKey

Creates a new null KKey.

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

KKey ( int keyQt ) | ### KKey

Creates a new key for the given Qt key code.

Parameters:

keyQt | the qt keycode

See also: Qt::Key

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

Creates a new key from the first key code of the given key sequence.

Parameters:

keySeq | the key sequence that contains the key

KKey ( const QKeyEvent* keyEvent ) | ### KKey

Extracts the key from the given key event.

Parameters:

keyEvent | the key event to get the key from

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

Copy constructor.

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

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.

Parameters:

key | the description of the key

See also: KKeyServer::Sym::init()

KKey ( uint key, uint mod ) | ### KKey

~KKey () | ### ~KKey

void clear () | ### clear

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

See also: isNull()

bool init ( int keyQt ) | ### init

Initializes the key with the given Qt key code.

Parameters:

keyQt | the qt keycode

Returns: true if successful, false otherwise

See also: Qt::Key

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

Initializes the key with the first key code of the given key sequence.

Parameters:

keySeq | the key sequence that contains the key

Returns: true if successful, false otherwise

bool init ( const QKeyEvent* keyEvent ) | ### init

Initializes the key by extracting the code from the given key event.

Parameters:

keyEvent | the key event to get the key from

Returns: true if successful, false otherwise

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

Copies the given key.

Parameters:

key | the key to copy

Returns: true if successful, false otherwise

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

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.

Parameters:

key | the description of the key

Returns: true if successful, false otherwise

See also: KKeyServer::Sym::init()

bool init ( uint key, uint mod ) | ### init

KKey& operator = ( const KKey& key ) | ### operator =

Copies the key.

bool isNull () | ### isNull

[const]

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

Returns: true if the key is null

See also: clear(), null()

bool isValidQt () | ### isValidQt

[const]

bool isValidNative () | ### isValidNative

[const]

uint sym () | ### sym

[const]

uint modFlags () | ### modFlags

[const]

int compare ( const KKey& key ) | ### compare

[const]

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.

Parameters:

key | the key to compare with this key

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

bool operator == ( const KKey& key ) | ### operator ==

[const]

Compares the symbol and modifiers of both keys.

See also: compare()

bool operator != ( const KKey& key ) | ### operator !=

[const]

Compares the symbol and modifiers of both keys.

See also: compare()

bool operator < ( const KKey& key ) | ### operator <

[const]

Compares the symbol and modifiers of both keys.

See also: compare()

int keyCodeQt () | ### keyCodeQt

[const]

Returns the qt key code.

Returns: the qt key code or 0 if there is no key set.

See also: Qt::Key

QString toString () | ### toString

[const]

Returns a human-readable representation of the key in the form "modifier+key".

Returns: the string representation of the key

QString toStringInternal () | ### toStringInternal

[const]

void simplify () | ### simplify

KKey& null () | ### null

[static]

Returns a null key.

Returns: the null key

See also: isNull(), clear()

QString modFlagLabel ( ModFlag f ) | ### modFlagLabel

[static]

Returns a user-readable representation of the given modifiers.

Parameters:

f | the modifiers to convert

Returns: the string representation of the modifiers

uint m_sym | ### m_sym

uint m_mod | ### m_mod

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