QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
QwtEventPattern Class Reference

A collection of event patterns. More...

#include <qwt_event_pattern.h>

Inheritance diagram for QwtEventPattern:
QwtPicker QwtCanvasPicker QwtPlotPanner QwtPlotPicker QwtPolarPicker QwtPlotCanvasZoomer QwtPlotSeriesDataPicker QwtPlotAxisZoomer

Classes

class  KeyPattern
 A pattern for key events. More...
 
class  MousePattern
 A pattern for mouse events. More...
 

Public Types

enum  MousePatternCode {
  MouseSelect1 , MouseSelect2 , MouseSelect3 , MouseSelect4 ,
  MouseSelect5 , MouseSelect6 , MousePatternCount
}
 Symbolic mouse input codes. More...
 
enum  KeyPatternCode {
  KeySelect1 , KeySelect2 , KeyAbort , KeyLeft ,
  KeyRight , KeyUp , KeyDown , KeyRedo ,
  KeyUndo , KeyHome , KeyPatternCount
}
 Symbolic keyboard input codes. More...
 

Public Member Functions

 QwtEventPattern ()
 Constructor.
 
virtual ~QwtEventPattern ()
 Destructor.
 
void initMousePattern (int numButtons)
 Set default mouse patterns depending on the number of mouse buttons.
 
void initKeyPattern ()
 Set default key patterns.
 
void setMousePattern (MousePatternCode, Qt::MouseButton button, Qt::KeyboardModifiers=Qt::NoModifier)
 Change one mouse pattern.
 
void setKeyPattern (KeyPatternCode, int key, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
 Change one key pattern.
 
void setMousePattern (const QVector< MousePattern > &)
 Change the mouse event patterns.
 
void setKeyPattern (const QVector< KeyPattern > &)
 Change the key event patterns.
 
const QVector< MousePattern > & mousePattern () const
 Return the mouse pattern vector.
 
const QVector< KeyPattern > & keyPattern () const
 Return the key pattern vector.
 
QVector< MousePattern > & mousePattern ()
 Return the mouse pattern vector.
 
QVector< KeyPattern > & keyPattern ()
 Return the key pattern vector.
 
bool mouseMatch (MousePatternCode, const QMouseEvent *) const
 Compare a mouse event with an event pattern.
 
bool keyMatch (KeyPatternCode, const QKeyEvent *) const
 Compare a key event with an event pattern.
 

Protected Member Functions

virtual bool mouseMatch (const MousePattern &, const QMouseEvent *) const
 Compare a mouse event with an event pattern.
 
virtual bool keyMatch (const KeyPattern &, const QKeyEvent *) const
 Compare a key event with an event pattern.
 

Detailed Description

A collection of event patterns.

QwtEventPattern introduces a 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

◆ KeyPatternCode

Symbolic keyboard input codes.

Individual settings can be configured using setKeyPattern()

See also
setKeyPattern(), setMousePattern()
Enumerator
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.

KeyRedo 

Qt::Key_Plus.

KeyUndo 

Qt::Key_Minus.

KeyHome 

Qt::Key_Escape.

KeyPatternCount 

Number of key patterns.

◆ MousePatternCode

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().

See also
initMousePattern(), setMousePattern(), setKeyPattern()
Enumerator
MouseSelect1 

The default setting for 1, 2 and 3 button mice is:

  • Qt::LeftButton
  • Qt::LeftButton
  • Qt::LeftButton
MouseSelect2 

The default setting for 1, 2 and 3 button mice is:

  • Qt::LeftButton + Qt::ControlModifier
  • Qt::RightButton
  • Qt::RightButton
MouseSelect3 

The default setting for 1, 2 and 3 button mice is:

  • Qt::LeftButton + Qt::AltModifier
  • Qt::LeftButton + Qt::AltModifier
  • Qt::MidButton
MouseSelect4 

The default setting for 1, 2 and 3 button mice is:

  • Qt::LeftButton + Qt::ShiftModifier
  • Qt::LeftButton + Qt::ShiftModifier
  • Qt::LeftButton + Qt::ShiftModifier
MouseSelect5 

The default setting for 1, 2 and 3 button mice is:

  • Qt::LeftButton + Qt::ControlButton | Qt::ShiftModifier
  • Qt::RightButton + Qt::ShiftModifier
  • Qt::RightButton + Qt::ShiftModifier
MouseSelect6 

The default setting for 1, 2 and 3 button mice is:

  • Qt::LeftButton + Qt::AltModifier + Qt::ShiftModifier
  • Qt::LeftButton + Qt::AltModifier | Qt::ShiftModifier
  • Qt::MidButton + Qt::ShiftModifier
MousePatternCount 

Number of mouse patterns.

Constructor & Destructor Documentation

◆ QwtEventPattern()

QwtEventPattern::QwtEventPattern ( )

Constructor.

Initializes mouse and key patterns with default settings.

See also
MousePatternCode, KeyPatternCode

Member Function Documentation

◆ initKeyPattern()

void QwtEventPattern::initKeyPattern ( )

Set default key patterns.

See also
KeyPatternCode

◆ initMousePattern()

void QwtEventPattern::initMousePattern ( int  numButtons)

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

Parameters
[in]numButtonsNumber of mouse buttons (<= 3)
See also
MousePatternCode

◆ keyMatch() [1/2]

bool QwtEventPattern::keyMatch ( const KeyPattern pattern,
const QKeyEvent *  event 
) const
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.

Parameters
patternKey event pattern
eventKey event
Returns
true if matches
See also
mouseMatch()

◆ keyMatch() [2/2]

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.

Parameters
[in]codeIndex of the event pattern
[in]eventKey event
Returns
true if matches, false otherwise
See also
mouseMatch()

◆ keyPattern() [1/2]

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

Return the key pattern vector.

Returns
Key pattern vector (mutable)

◆ keyPattern() [2/2]

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

Return the key pattern vector.

Returns
Key pattern vector (const)

◆ mouseMatch() [1/2]

bool QwtEventPattern::mouseMatch ( const MousePattern pattern,
const QMouseEvent *  event 
) const
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.

Parameters
patternMouse event pattern
eventMouse event
Returns
true if matches
See also
keyMatch()

◆ mouseMatch() [2/2]

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.

Parameters
[in]codeIndex of the event pattern
[in]eventMouse event
Returns
true if matches, false otherwise
See also
keyMatch()

◆ mousePattern() [1/2]

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

Return the mouse pattern vector.

Returns
Mouse pattern vector (mutable)

◆ mousePattern() [2/2]

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

Return the mouse pattern vector.

Returns
Mouse pattern vector (const)

◆ setKeyPattern() [1/2]

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

Change the key event patterns.

Parameters
[in]patternVector of key patterns

◆ setKeyPattern() [2/2]

void QwtEventPattern::setKeyPattern ( KeyPatternCode  pattern,
int  key,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
)

Change one key pattern.

Parameters
[in]patternIndex of the pattern
[in]keyKey code
[in]modifiersKeyboard modifiers
See also
QKeyEvent

◆ setMousePattern() [1/2]

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

Change the mouse event patterns.

Parameters
[in]patternVector of mouse patterns

◆ setMousePattern() [2/2]

void QwtEventPattern::setMousePattern ( MousePatternCode  pattern,
Qt::MouseButton  button,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
)

Change one mouse pattern.

Parameters
[in]patternIndex of the pattern
[in]buttonMouse button
[in]modifiersKeyboard modifiers
See also
QMouseEvent

The documentation for this class was generated from the following files: