A collection of event patterns. More...
#include <qwt_event_pattern.h>
Classes | |
class | KeyPattern |
A pattern for key events. More... | |
class | MousePattern |
A pattern for mouse events. More... | |
Public Types | |
enum | KeyPatternCode { KeySelect1, KeySelect2, KeyAbort, KeyLeft, KeyRight, KeyUp, KeyDown, KeyRedo, KeyUndo, KeyHome, KeyPatternCount } |
Symbolic keyboard input codes. More... | |
enum | MousePatternCode { MouseSelect1, MouseSelect2, MouseSelect3, MouseSelect4, MouseSelect5, MouseSelect6, MousePatternCount } |
Symbolic mouse input codes. More... | |
Public Member Functions | |
void | initKeyPattern () |
void | initMousePattern (int numButtons) |
bool | keyMatch (KeyPatternCode, const QKeyEvent *) const |
Compare a key event with an event pattern. More... | |
const QVector< KeyPattern > & | keyPattern () const |
QVector< KeyPattern > & | keyPattern () |
bool | mouseMatch (MousePatternCode, const QMouseEvent *) const |
Compare a mouse event with an event pattern. More... | |
const QVector< MousePattern > & | mousePattern () const |
QVector< MousePattern > & | mousePattern () |
QwtEventPattern () | |
void | setKeyPattern (KeyPatternCode, int keyCode, Qt::KeyboardModifiers modifierCodes=Qt::NoModifier) |
void | setKeyPattern (const QVector< KeyPattern > &) |
Change the key event patterns. More... | |
void | setMousePattern (MousePatternCode, Qt::MouseButton button, Qt::KeyboardModifiers=Qt::NoModifier) |
void | setMousePattern (const QVector< MousePattern > &) |
Change the mouse event patterns. More... | |
virtual | ~QwtEventPattern () |
Destructor. More... | |
Protected Member Functions | |
virtual bool | keyMatch (const KeyPattern &, const QKeyEvent *) const |
Compare a key event with an event pattern. More... | |
virtual bool | mouseMatch (const MousePattern &, const QMouseEvent *) const |
Compare a mouse event with an event pattern. More... | |
Private Attributes | |
QVector< KeyPattern > | d_keyPattern |
QVector< MousePattern > | d_mousePattern |
A collection of event patterns.
QwtEventPattern introduces an level of indirection for mouse and keyboard inputs. Those are represented by symbolic names, so the application code can be configured by individual mappings.
Definition at line 29 of file qwt_event_pattern.h.
Symbolic keyboard input codes.
Individual settings can be configured using setKeyPattern()
Definition at line 111 of file qwt_event_pattern.h.
Symbolic mouse input codes.
QwtEventPattern implements 3 different settings for mice with 1, 2, or 3 buttons that can be activated using initMousePattern(). The default setting is for 3 button mice.
Individual settings can be configured using setMousePattern().
Definition at line 44 of file qwt_event_pattern.h.
QwtEventPattern::QwtEventPattern | ( | ) |
Constructor
Definition at line 19 of file qwt_event_pattern.cpp.
|
virtual |
Destructor.
Definition at line 28 of file qwt_event_pattern.cpp.
void QwtEventPattern::initKeyPattern | ( | ) |
Set default mouse patterns.
Definition at line 81 of file qwt_event_pattern.cpp.
void QwtEventPattern::initMousePattern | ( | int | numButtons | ) |
Set default mouse patterns, depending on the number of mouse buttons
numButtons | Number of mouse buttons ( <= 3 ) |
Definition at line 38 of file qwt_event_pattern.cpp.
bool QwtEventPattern::keyMatch | ( | KeyPatternCode | code, |
const QKeyEvent * | event | ||
) | const |
Compare a key event with an event pattern.
A key event matches the pattern when both have the same key value and in the state value the same key flags (Qt::KeyButtonMask) are set.
code | Index of the event pattern |
event | Key event |
Definition at line 234 of file qwt_event_pattern.cpp.
|
protectedvirtual |
Compare a key event with an event pattern.
A key event matches the pattern when both have the same key value and in the state value the same key flags (Qt::KeyButtonMask) are set.
pattern | Key event pattern |
event | Key event |
Definition at line 257 of file qwt_event_pattern.cpp.
const QVector< QwtEventPattern::KeyPattern > & QwtEventPattern::keyPattern | ( | ) | const |
Definition at line 158 of file qwt_event_pattern.cpp.
QVector< QwtEventPattern::KeyPattern > & QwtEventPattern::keyPattern | ( | ) |
Definition at line 170 of file qwt_event_pattern.cpp.
bool QwtEventPattern::mouseMatch | ( | MousePatternCode | code, |
const QMouseEvent * | event | ||
) | const |
Compare a mouse event with an event pattern.
A mouse event matches the pattern when both have the same button value and in the state value the same key flags(Qt::KeyButtonMask) are set.
code | Index of the event pattern |
event | Mouse event |
Definition at line 188 of file qwt_event_pattern.cpp.
|
protectedvirtual |
Compare a mouse event with an event pattern.
A mouse event matches the pattern when both have the same button value and in the state value the same key flags(Qt::KeyButtonMask) are set.
pattern | Mouse event pattern |
event | Mouse event |
Definition at line 211 of file qwt_event_pattern.cpp.
const QVector< QwtEventPattern::MousePattern > & QwtEventPattern::mousePattern | ( | ) | const |
Definition at line 151 of file qwt_event_pattern.cpp.
QVector< QwtEventPattern::MousePattern > & QwtEventPattern::mousePattern | ( | ) |
Definition at line 164 of file qwt_event_pattern.cpp.
void QwtEventPattern::setKeyPattern | ( | KeyPatternCode | pattern, |
int | key, | ||
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) |
Change one key pattern
pattern | Index of the pattern |
key | Key |
modifiers | Keyboard modifiers |
Definition at line 127 of file qwt_event_pattern.cpp.
void QwtEventPattern::setKeyPattern | ( | const QVector< KeyPattern > & | pattern | ) |
Change the key event patterns.
Definition at line 144 of file qwt_event_pattern.cpp.
void QwtEventPattern::setMousePattern | ( | MousePatternCode | pattern, |
Qt::MouseButton | button, | ||
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) |
Change one mouse pattern
pattern | Index of the pattern |
button | Button |
modifiers | Keyboard modifiers |
Definition at line 108 of file qwt_event_pattern.cpp.
void QwtEventPattern::setMousePattern | ( | const QVector< MousePattern > & | pattern | ) |
Change the mouse event patterns.
Definition at line 138 of file qwt_event_pattern.cpp.
|
private |
Definition at line 220 of file qwt_event_pattern.h.
|
private |
Definition at line 219 of file qwt_event_pattern.h.