org.kde.koala

Class KKey

public class KKey extends Object implements QtSupport

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 KKeySequence KShortcut

UNKNOWN: A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).

Field Summary
static intALT
static intCTRL
static intMOD_FLAG_COUNT
The number of flags.
static intQtWIN
static intSHIFT
Flags to represent the modifiers.
static intWIN
Constructor Summary
protected KKey(Class dummy)
KKey()
Creates a new null KKey.
KKey(int keyQt)
Creates a new key for the given Qt key code.
KKey(QKeySequence keySeq)
Creates a new key from the first key code of the given key sequence.
KKey(QKeyEvent keyEvent)
Extracts the key from the given key event.
KKey(KKey key)
Copy constructor.
KKey(String key)
Creates a new key from the given description.
KKey(int key, int mod)
Method Summary
voidclear()
Clears the key.
intcompare(KKey key)
Compares this key with the given KKey object.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected voidfinalize()
Deletes the wrapped C++ instance
booleaninit(int keyQt)
Initializes the key with the given Qt key code.
booleaninit(QKeySequence keySeq)
Initializes the key with the first key code of the given key sequence.
booleaninit(QKeyEvent keyEvent)
Initializes the key by extracting the code from the given key event.
booleaninit(KKey key)
Copies the given key.
booleaninit(String key)
Initializes the key with the given description.
booleaninit(int key, int mod)
booleanisDisposed()
Has the wrapped C++ instance been deleted?
booleanisNull()
Returns true if the key is null (after clear() or empty constructor).
intkeyCodeQt()
Returns the qt key code.
static StringmodFlagLabel(int f)
Returns a user-readable representation of the given modifiers.
intmodFlags()
static KKeynil()
Returns a null key.
booleanop_equals(KKey key)
Compares the symbol and modifiers of both keys.
booleanop_lt(KKey key)
Compares the symbol and modifiers of both keys.
booleanop_not_equals(KKey key)
Compares the symbol and modifiers of both keys.
voidsimplify()
intsym()
StringtoString()
Returns a human-readable representation of the key in the form "modifier+key".
StringtoStringInternal()
Returns an untranslated text representation of the key in the form "modifier+key", suitable e.g. for saving in configuration files.

Field Detail

ALT

public static final int ALT

CTRL

public static final int CTRL

MOD_FLAG_COUNT

public static final int MOD_FLAG_COUNT
The number of flags.

See Also: ModFlag

UNKNOWN: The number of flags.

QtWIN

public static final int QtWIN

SHIFT

public static final int SHIFT
Flags to represent the modifiers. You can combine modifiers by ORing them.

UNKNOWN: Flags to represent the modifiers.

WIN

public static final int WIN

Constructor Detail

KKey

protected KKey(Class dummy)

KKey

public KKey()
Creates a new null KKey.

See Also: KKey KKey KKey

UNKNOWN: Creates a new null KKey.

KKey

public KKey(int keyQt)
Creates a new key for the given Qt key code.

Parameters: keyQt the qt keycode

See Also: org.kde.qt.Qt#Key

UNKNOWN: Creates a new key for the given Qt key code.

KKey

public KKey(QKeySequence keySeq)
Creates a new key from the first key code of the given key sequence.

Parameters: keySeq the key sequence that contains the key

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

KKey

public KKey(QKeyEvent keyEvent)
Extracts the key from the given key event.

Parameters: keyEvent the key event to get the key from

UNKNOWN: Extracts the key from the given key event.

KKey

public KKey(KKey key)
Copy constructor.

UNKNOWN: Copy constructor.

KKey

public KKey(String key)
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

UNKNOWN: Creates a new key from the given description.

KKey

public KKey(int key, int mod)

UNKNOWN:

Method Detail

clear

public void clear()
Clears the key. The key is null after calling this function.

See Also: KKey

UNKNOWN: Clears the key.

compare

public int compare(KKey key)
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

UNKNOWN: Compares this key with the given KKey object.

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

finalize

protected void finalize()
Deletes the wrapped C++ instance

init

public boolean init(int keyQt)
Initializes the key with the given Qt key code.

Parameters: keyQt the qt keycode

Returns: true if successful, false otherwise

See Also: org.kde.qt.Qt#Key

UNKNOWN: Initializes the key with the given Qt key code.

init

public boolean init(QKeySequence keySeq)
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

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

init

public boolean init(QKeyEvent keyEvent)
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

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

init

public boolean init(KKey key)
Copies the given key.

Parameters: key the key to copy

Returns: true if successful, false otherwise

UNKNOWN: Copies the given key.

init

public boolean init(String key)
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

UNKNOWN: Initializes the key with the given description.

init

public boolean init(int key, int mod)

UNKNOWN:

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

isNull

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

Returns: true if the key is null

See Also: KKey KKey

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

keyCodeQt

public int keyCodeQt()
Returns the qt key code.

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

See Also: org.kde.qt.Qt#Key

UNKNOWN: Returns the qt key code.

modFlagLabel

public static String modFlagLabel(int f)
Returns a user-readable representation of the given modifiers.

Parameters: f the modifiers to convert

Returns: the string representation of the modifiers

UNKNOWN: Returns a user-readable representation of the given modifiers.

modFlags

public int modFlags()

UNKNOWN:

nil

public static KKey nil()
Returns a null key.

Returns: the null key

See Also: KKey KKey

UNKNOWN: Returns a null key.

op_equals

public boolean op_equals(KKey key)
Compares the symbol and modifiers of both keys.

See Also: KKey

UNKNOWN: Compares the symbol and modifiers of both keys.

op_lt

public boolean op_lt(KKey key)
Compares the symbol and modifiers of both keys.

See Also: KKey

UNKNOWN: Compares the symbol and modifiers of both keys.

op_not_equals

public boolean op_not_equals(KKey key)
Compares the symbol and modifiers of both keys.

See Also: KKey

UNKNOWN: Compares the symbol and modifiers of both keys.

simplify

public void simplify()

UNKNOWN:

sym

public int sym()

UNKNOWN:

toString

public String toString()
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.

Returns: the string representation of the key

See Also: KKey

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

toStringInternal

public String toStringInternal()
Returns an untranslated text representation of the key in the form "modifier+key", suitable e.g. for saving in configuration files.

UNKNOWN: Returns an untranslated text representation of the key in the form "modifier+key", suitable e.