|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KShortcut
public class KShortcut
The KShortcut class is used to represent a keyboard shortcut to an action. A shortcut is normally a single key with modifiers, such as Ctrl+V. A KShortcut object may also contain an alternate key which will also activate the action it's associated to, as long as no other actions have defined that key as their primary key. Ex: Ctrl+V;Shift+Insert. This can be used to add additional accelerators to a KAction. For example, the below code binds the escape key to the close action.
KAction closeAction = KStdAction.close( this, SLOT("close()"), actionCollection() ); KShortcut closeShortcut = closeAction.shortcut(); closeShortcut.append( KKey(Key_Escape)); closeAction.setShortcut(closeShortcut);Note that a shortcut cannot have more than 2 key combinations associated with it, so the above code would not do anything (and append() would return false) if the closeAction already had an key and alternate key.
Field Summary | |
---|---|
static int |
MAX_SEQUENCES
The maximum number of key sequences that can be contained in a KShortcut. |
Constructor Summary | |
---|---|
|
KShortcut()
Creates a new null shortcut. |
protected |
KShortcut(java.lang.Class dummy)
|
|
KShortcut(int keyQt)
Creates a new shortcut with the given Qt key code as the only key sequence. |
|
KShortcut(KKey key)
Creates a new shortcut that contains only the given key in its only sequence. |
|
KShortcut(KKeySequence keySeq)
Creates a new shortcut that contains only the given key sequence. |
|
KShortcut(KShortcut shortcut)
Copies the given shortcut. |
|
KShortcut(org.kde.qt.QKeySequence keySeq)
Creates a new shortcut that contains only the given qt key sequence. |
|
KShortcut(java.lang.String shortcut)
Creates a new key sequence that contains the given key sequence. |
Method Summary | |
---|---|
boolean |
append(KKey spec)
Appends the given key |
boolean |
append(KKeySequence keySeq)
Appends the given key sequence. |
boolean |
append(KShortcut cut)
Appends the sequences from the given shortcut. |
void |
clear()
Clears the shortcut. |
int |
compare(KShortcut shortcut)
Compares this object with the given shortcut. |
boolean |
contains(KKey key)
Checks whether this shortcut contains a sequence that starts with the given key. |
boolean |
contains(KKeySequence keySeq)
Checks whether this shortcut contains the given sequence. |
int |
count()
Returns the number of sequences that are in this shortcut. |
void |
dispose()
Delete the wrapped C++ instance ahead of finalize() |
protected void |
finalize()
Deletes the wrapped C++ instance |
boolean |
init(int keyQt)
Initializes the shortcut with the given Qt key code as the only key sequence. |
boolean |
init(KKey key)
Initializes the shortcut with the given key as its only sequence. |
boolean |
init(KKeySequence keySeq)
Initializes the shortcut with the given qt key sequence. |
boolean |
init(KShortcut shortcut)
Copies the given shortcut. |
boolean |
init(org.kde.qt.QKeySequence keySeq)
Initializes the shortcut with the given qt key sequence. |
boolean |
init(java.lang.String shortcut)
Initializes the key sequence with the given key sequence. |
boolean |
isDisposed()
Has the wrapped C++ instance been deleted? |
boolean |
isNull()
Returns true if the shortcut is null (after clear() or empty constructor). |
int |
keyCodeQt()
Returns the key code of the first key sequence, or null if there is no first key sequence. |
static KShortcut |
nil()
Returns a null shortcut. |
boolean |
op_equals(KShortcut cut)
Compares the sequences of both shortcuts. |
boolean |
op_lt(KShortcut cut)
Compares the sequences of both shortcuts. |
boolean |
op_not_equals(KShortcut cut)
Compares the sequences of both shortcuts. |
void |
remove(KKeySequence keySeq)
Removes the given key sequence from this shortcut |
KKeySequence |
seq(int i)
Returns the i 'th key sequence of this shortcut. |
boolean |
setSeq(int i,
KKeySequence keySeq)
Sets the i 'th key sequence of the shortcut. |
java.lang.String |
toString()
Returns a description of the shortcut as semicolon-separated ket sequences, as returned by KKeySequence.toString(). |
java.lang.String |
toStringInternal()
|
java.lang.String |
toStringInternal(KShortcut pcutDefault)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_SEQUENCES
Constructor Detail |
---|
protected KShortcut(java.lang.Class dummy)
public KShortcut()
#null
,
isNull()
,
clear()
public KShortcut(int keyQt)
keyQt
- the qt keycodeorg.kde.qt.Qt#Key
public KShortcut(org.kde.qt.QKeySequence keySeq)
keySeq
- the qt key sequence to addpublic KShortcut(KKey key)
key
- the key to addpublic KShortcut(KKeySequence keySeq)
keySeq
- the key sequence to addpublic KShortcut(KShortcut shortcut)
shortcut
- the shortcut to addpublic KShortcut(java.lang.String shortcut)
shortcut
- the description of the keyKKeySequence#KKeySequence(const
Method Detail |
---|
public void clear()
isNull()
public boolean init(int keyQt)
keyQt
- the qt keycodeorg.kde.qt.Qt#Key
public boolean init(org.kde.qt.QKeySequence keySeq)
keySeq
- the qt key sequence to addpublic boolean init(KKey key)
key
- the key to addpublic boolean init(KKeySequence keySeq)
keySeq
- the qt key sequence to addpublic boolean init(KShortcut shortcut)
shortcut
- the shortcut to addpublic boolean init(java.lang.String shortcut)
shortcut
- the description of the keyKKeySequence#KKeySequence(const
public int count()
public KKeySequence seq(int i)
i
'th key sequence of this shortcut.
i
- the number of the key sequence to retrieve
i
'th sequence or KKeySequence.null() if
there are less than i
key sequences
MAX_SEQUENCESpublic int keyCodeQt()
org.kde.qt.Qt#Key
,
KKeySequence.keyCodeQt()
public boolean isNull()
clear()
,
#null
public int compare(KShortcut shortcut)
shortcut
- the shortcut to compare to
KKey.compare(org.kde.koala.KKey)
,
KKeyShortcut#compare
public boolean op_equals(KShortcut cut)
compare(org.kde.koala.KShortcut)
public boolean op_not_equals(KShortcut cut)
compare(org.kde.koala.KShortcut)
public boolean op_lt(KShortcut cut)
compare(org.kde.koala.KShortcut)
public boolean contains(KKey key)
key
- the key to check
public boolean contains(KKeySequence keySeq)
keySeq
- the key sequence to check
public boolean setSeq(int i, KKeySequence keySeq)
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.
i
- the position of the new key sequence(0 <= i <= count(), 0 <= i < MAX_SEQUENCES)keySeq
- the key sequence to set
public boolean append(KKeySequence keySeq)
keySeq
- the key sequence to add
setSeq(int, org.kde.koala.KKeySequence)
public void remove(KKeySequence keySeq)
keySeq
- the key sequence to removepublic boolean append(KKey spec)
spec
- the key to add
setSeq(int, org.kde.koala.KKeySequence)
,
MAX_SEQUENCES
public boolean append(KShortcut cut)
cut
- the shortcut to append
MAX_SEQUENCES
public java.lang.String toString()
toString
in class java.lang.Object
KKey.toString()
,
KKeySequence.toString()
public java.lang.String toStringInternal(KShortcut pcutDefault)
public java.lang.String toStringInternal()
public static KShortcut nil()
isNull()
,
clear()
protected void finalize() throws java.lang.InternalError
finalize
in class java.lang.Object
java.lang.InternalError
public void dispose()
public boolean isDisposed()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |