Qt 4.8
|
#include <qshortcutmap_p.h>
Public Functions | |
int | addShortcut (QObject *owner, const QKeySequence &key, Qt::ShortcutContext context) |
Adds a shortcut to the global map. More... | |
void | dispatchEvent (QKeyEvent *e) |
Dispatches QShortcutEvents to widgets who grabbed the matched key sequence. More... | |
bool | hasShortcutForKeySequence (const QKeySequence &seq) const |
Determines if an enabled shortcut has a matcing key sequence. More... | |
QKeySequence::SequenceMatch | nextState (QKeyEvent *e) |
QShortcutMap () | |
QShortcutMap constructor. More... | |
int | removeShortcut (int id, QObject *owner, const QKeySequence &key=QKeySequence()) |
Removes a shortcut from the global map. More... | |
void | resetState () |
int | setShortcutAutoRepeat (bool on, int id, QObject *owner, const QKeySequence &key=QKeySequence()) |
Changes the auto repeat state of a shortcut to enable. More... | |
int | setShortcutEnabled (bool enable, int id, QObject *owner, const QKeySequence &key=QKeySequence()) |
Changes the enable state of a shortcut to enable. More... | |
QKeySequence::SequenceMatch | state () |
bool | tryShortcutEvent (QObject *o, QKeyEvent *e) |
Uses ShortcutOverride event to see if any widgets want to override the event. More... | |
~QShortcutMap () | |
QShortcutMap destructor. More... | |
Private Functions | |
void | clearSequence (QVector< QKeySequence > &ksl) |
Clears seq to an empty QKeySequence. More... | |
bool | correctContext (Qt::ShortcutContext context, QAction *a, QWidget *active_window) const |
bool | correctContext (const QShortcutEntry &item) const |
Returns true if the widget w is a logical sub window of the current top-level widget. More... | |
bool | correctGraphicsWidgetContext (Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window) const |
bool | correctWidgetContext (Qt::ShortcutContext context, QWidget *w, QWidget *active_window) const |
void | createNewSequences (QKeyEvent *e, QVector< QKeySequence > &ksl) |
Alters seq to the new sequence state, based on the current sequence state, and the new key event e. More... | |
QKeySequence::SequenceMatch | find (QKeyEvent *e) |
Returns the next state of the statemachine, based on the new key event e. More... | |
QKeySequence::SequenceMatch | matches (const QKeySequence &seq1, const QKeySequence &seq2) const |
Basically the same function as QKeySequence::matches(const QKeySequence &seq) const only that is specially handles Key_hyphen as Key_Minus, as people mix these up all the time and they conceptually the same. More... | |
QVector< const QShortcutEntry * > | matches () const |
Returns the vector of QShortcutEntry's matching the last Identical state. More... | |
int | translateModifiers (Qt::KeyboardModifiers modifiers) |
Properties | |
QScopedPointer< QShortcutMapPrivate > | d_ptr |
Definition at line 75 of file qshortcutmap_p.h.
QShortcutMap::QShortcutMap | ( | ) |
QShortcutMap constructor.
Definition at line 154 of file qshortcutmap.cpp.
QShortcutMap::~QShortcutMap | ( | ) |
QShortcutMap destructor.
Definition at line 166 of file qshortcutmap.cpp.
int QShortcutMap::addShortcut | ( | QObject * | owner, |
const QKeySequence & | key, | ||
Qt::ShortcutContext | context | ||
) |
Adds a shortcut to the global map.
Returns the id of the newly added shortcut.
Definition at line 177 of file qshortcutmap.cpp.
Referenced by QActionPrivate::redoGrab(), QShortcutPrivate::redoGrab(), and QActionPrivate::redoGrabAlternate().
|
private |
Clears seq to an empty QKeySequence.
Same as doing (the slower)
Definition at line 584 of file qshortcutmap.cpp.
Referenced by find(), nextState(), and resetState().
|
private |
Definition at line 827 of file qshortcutmap.cpp.
Referenced by correctContext(), find(), and hasShortcutForKeySequence().
|
private |
Returns true if the widget w is a logical sub window of the current top-level widget.
Definition at line 675 of file qshortcutmap.cpp.
|
private |
Definition at line 767 of file qshortcutmap.cpp.
Referenced by correctContext(), and correctWidgetContext().
|
private |
Definition at line 704 of file qshortcutmap.cpp.
Referenced by correctContext().
|
private |
Alters seq to the new sequence state, based on the current sequence state, and the new key event e.
Definition at line 597 of file qshortcutmap.cpp.
Referenced by find().
void QShortcutMap::dispatchEvent | ( | QKeyEvent * | e | ) |
Dispatches QShortcutEvents to widgets who grabbed the matched key sequence.
Definition at line 898 of file qshortcutmap.cpp.
Referenced by tryShortcutEvent().
|
private |
Returns the next state of the statemachine, based on the new key event e.
Matches are appended to the vector of identicals, which can be access through matches().
Definition at line 483 of file qshortcutmap.cpp.
Referenced by nextState().
bool QShortcutMap::hasShortcutForKeySequence | ( | const QKeySequence & | seq | ) | const |
Determines if an enabled shortcut has a matcing key sequence.
Definition at line 456 of file qshortcutmap.cpp.
|
private |
Basically the same function as QKeySequence::matches(const QKeySequence &seq) const only that is specially handles Key_hyphen as Key_Minus, as people mix these up all the time and they conceptually the same.
Definition at line 640 of file qshortcutmap.cpp.
|
private |
Returns the vector of QShortcutEntry's matching the last Identical state.
Definition at line 886 of file qshortcutmap.cpp.
Referenced by find(), and hasShortcutForKeySequence().
QKeySequence::SequenceMatch QShortcutMap::nextState | ( | QKeyEvent * | e | ) |
Definition at line 406 of file qshortcutmap.cpp.
Referenced by tryShortcutEvent().
int QShortcutMap::removeShortcut | ( | int | id, |
QObject * | owner, | ||
const QKeySequence & | key = QKeySequence() |
||
) |
Removes a shortcut from the global map.
If owner is 0, all entries in the map with the key sequence specified is removed. If key is null, all sequences for owner is removed from the map. If id is 0, any identical key sequences owned by owner are removed. Returns the number of sequences removed from the map.
Definition at line 206 of file qshortcutmap.cpp.
Referenced by QActionPrivate::redoGrab(), QShortcutPrivate::redoGrab(), and QActionPrivate::redoGrabAlternate().
void QShortcutMap::resetState | ( | ) |
Definition at line 329 of file qshortcutmap.cpp.
Referenced by QShortcutMap(), and tryShortcutEvent().
int QShortcutMap::setShortcutAutoRepeat | ( | bool | on, |
int | id, | ||
QObject * | owner, | ||
const QKeySequence & | key = QKeySequence() |
||
) |
Changes the auto repeat state of a shortcut to enable.
If owner is 0, all entries in the map with the key sequence specified is removed. If key is null, all sequences for owner is removed from the map. If id is 0, any identical key sequences owned by owner are changed. Returns the number of sequences which are matched in the map.
Definition at line 296 of file qshortcutmap.cpp.
Referenced by QActionPrivate::redoGrab(), QShortcutPrivate::redoGrab(), and QActionPrivate::redoGrabAlternate().
int QShortcutMap::setShortcutEnabled | ( | bool | enable, |
int | id, | ||
QObject * | owner, | ||
const QKeySequence & | key = QKeySequence() |
||
) |
Changes the enable state of a shortcut to enable.
If owner is 0, all entries in the map with the key sequence specified is removed. If key is null, all sequences for owner is removed from the map. If id is 0, any identical key sequences owned by owner are changed. Returns the number of sequences which are matched in the map.
Definition at line 255 of file qshortcutmap.cpp.
Referenced by QActionPrivate::redoGrab(), QShortcutPrivate::redoGrab(), QActionPrivate::redoGrabAlternate(), and QActionPrivate::setShortcutEnabled().
QKeySequence::SequenceMatch QShortcutMap::state | ( | ) |
Definition at line 339 of file qshortcutmap.cpp.
|
private |
Definition at line 866 of file qshortcutmap.cpp.
Uses ShortcutOverride event to see if any widgets want to override the event.
Definition at line 354 of file qshortcutmap.cpp.
|
private |
Definition at line 108 of file qshortcutmap_p.h.