QwtEventPattern Class Reference

A collection of event patterns. More...

#include <qwt_event_pattern.h>

Inheritance diagram for QwtEventPattern:

Inheritance graph
[legend]

List of all members.

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
}
enum  MousePatternCode {
  MouseSelect1,
  MouseSelect2,
  MouseSelect3,
  MouseSelect4,
  MouseSelect5,
  MouseSelect6,
  MousePatternCount
}

Public Member Functions

void initKeyPattern ()
void initMousePattern (int numButtons)
bool keyMatch (uint pattern, const QKeyEvent *) const
QVector< KeyPattern > & keyPattern ()
const QVector< KeyPattern > & keyPattern () const
bool mouseMatch (uint pattern, const QMouseEvent *) const
QVector< MousePattern > & mousePattern ()
const QVector< MousePattern > & mousePattern () const
 QwtEventPattern ()
void setKeyPattern (const QVector< KeyPattern > &)
void setKeyPattern (uint pattern, int key, int state=Qt::NoButton)
void setMousePattern (const QVector< MousePattern > &)
void setMousePattern (uint pattern, int button, int state=Qt::NoButton)
virtual ~QwtEventPattern ()

Protected Member Functions

virtual bool keyMatch (const KeyPattern &, const QKeyEvent *) const
virtual bool mouseMatch (const MousePattern &, const QMouseEvent *) const


Detailed Description

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.

See also:
QwtPicker, QwtPickerMachine, QwtPlotZoomer

Member Enumeration Documentation

Symbolic keyboard input codes.

Default initialization:

  • KeySelect1
    Qt::Key_Return
  • KeySelect2
    Qt::Key_Space
  • KeyAbort
    Qt::Key_Escape

  • KeyLeft
    Qt::Key_Left
  • KeyRight
    Qt::Key_Right
  • KeyUp
    Qt::Key_Up
  • KeyDown
    Qt::Key_Down

  • KeyUndo
    Qt::Key_Minus
  • KeyRedo
    Qt::Key_Plus
  • KeyHome
    Qt::Key_Escape

Symbolic mouse input codes.

The default initialization for 3 button mice is:

  • MouseSelect1
    Qt::LeftButton
  • MouseSelect2
    Qt::RightButton
  • MouseSelect3
    Qt::MidButton
  • MouseSelect4
    Qt::LeftButton + Qt::ShiftButton
  • MouseSelect5
    Qt::RightButton + Qt::ShiftButton
  • MouseSelect6
    Qt::MidButton + Qt::ShiftButton

The default initialization for 2 button mice is:

  • MouseSelect1
    Qt::LeftButton
  • MouseSelect2
    Qt::RightButton
  • MouseSelect3
    Qt::LeftButton + Qt::AltButton
  • MouseSelect4
    Qt::LeftButton + Qt::ShiftButton
  • MouseSelect5
    Qt::RightButton + Qt::ShiftButton
  • MouseSelect6
    Qt::LeftButton + Qt::AltButton + Qt::ShiftButton

The default initialization for 1 button mice is:

  • MouseSelect1
    Qt::LeftButton
  • MouseSelect2
    Qt::LeftButton + Qt::ControlButton
  • MouseSelect3
    Qt::LeftButton + Qt::AltButton
  • MouseSelect4
    Qt::LeftButton + Qt::ShiftButton
  • MouseSelect5
    Qt::LeftButton + Qt::ControlButton + Qt::ShiftButton
  • MouseSelect6
    Qt::LeftButton + Qt::AltButton + Qt::ShiftButton

See also:
initMousePattern()


Constructor & Destructor Documentation

QwtEventPattern::QwtEventPattern (  ) 

Constructor

See also:
MousePatternCode, KeyPatternCode

QwtEventPattern::~QwtEventPattern (  )  [virtual]

Destructor.


Member Function Documentation

void QwtEventPattern::initKeyPattern (  ) 

Set default mouse patterns.

See also:
KeyPatternCode

void QwtEventPattern::initMousePattern ( int  numButtons  ) 

Set default mouse patterns, depending on the number of mouse buttons

Parameters:
numButtons Number of mouse buttons ( <= 3 )
See also:
MousePatternCode

bool QwtEventPattern::keyMatch ( const KeyPattern pattern,
const QKeyEvent *  event 
) const [protected, virtual]

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.

Parameters:
pattern Key event pattern
event Key event
Returns:
true if matches
See also:
mouseMatch()

bool QwtEventPattern::keyMatch ( uint  pattern,
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.

Parameters:
pattern Index of the event pattern
event Key event
Returns:
true if matches
See also:
mouseMatch()

QVector< QwtEventPattern::KeyPattern > & QwtEventPattern::keyPattern (  ) 

Return Key patterns.

const QVector< QwtEventPattern::KeyPattern > & QwtEventPattern::keyPattern (  )  const

Return key patterns.

bool QwtEventPattern::mouseMatch ( const MousePattern pattern,
const QMouseEvent *  event 
) const [protected, virtual]

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.

Parameters:
pattern Mouse event pattern
event Mouse event
Returns:
true if matches
See also:
keyMatch()

bool QwtEventPattern::mouseMatch ( uint  pattern,
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.

Parameters:
pattern Index of the event pattern
event Mouse event
Returns:
true if matches
See also:
keyMatch()

QVector< QwtEventPattern::MousePattern > & QwtEventPattern::mousePattern (  ) 

Return ,ouse patterns.

const QVector< QwtEventPattern::MousePattern > & QwtEventPattern::mousePattern (  )  const

Return mouse patterns.

void QwtEventPattern::setKeyPattern ( const QVector< KeyPattern > &  pattern  ) 

Change the key event patterns.

void QwtEventPattern::setKeyPattern ( uint  pattern,
int  key,
int  state = Qt::NoButton 
)

Change one key pattern

Parameters:
pattern Index of the pattern
key Key
state State
See also:
QKeyEvent

void QwtEventPattern::setMousePattern ( const QVector< MousePattern > &  pattern  ) 

Change the mouse event patterns.

void QwtEventPattern::setMousePattern ( uint  pattern,
int  button,
int  state = Qt::NoButton 
)

Change one mouse pattern

Parameters:
pattern Index of the pattern
button Button
state State
See also:
QMouseEvent


Generated on Wed Jan 11 15:23:01 2012 for Qwt User's Guide by  doxygen 1.5.9