A state machine for point selections. More...
#include <qwt_picker_machine.h>
Public Member Functions | |
virtual CommandList | transition (const QwtEventPattern &, const QEvent *) |
Transition. |
A state machine for point selections.
Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1 starts the selection, releasing QwtEventPattern::MouseSelect1 or a second press of QwtEventPattern::KeySelect1 terminates it.
Definition at line 89 of file qwt_picker_machine.h.
QwtPickerMachine::CommandList QwtPickerDragPointMachine::transition | ( | const QwtEventPattern & | eventPattern, |
const QEvent * | e | ||
) | [virtual] |
Transition.
Implements QwtPickerMachine.
Definition at line 81 of file qwt_picker_machine.cpp.
References QwtPickerMachine::Append, QwtPickerMachine::Begin, QwtPickerMachine::End, QwtEventPattern::keyMatch(), QwtEventPattern::KeySelect1, QwtEventPattern::mouseMatch(), QwtEventPattern::MouseSelect1, QwtPickerMachine::Move, QwtPickerMachine::setState(), and QwtPickerMachine::state().
{ QwtPickerMachine::CommandList cmdList; switch(e->type()) { case QEvent::MouseButtonPress: { if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, (const QMouseEvent *)e) ) { if ( state() == 0 ) { cmdList += Begin; cmdList += Append; setState(1); } } break; } case QEvent::MouseMove: case QEvent::Wheel: { if ( state() != 0 ) cmdList += Move; break; } case QEvent::MouseButtonRelease: { if ( state() != 0 ) { cmdList += End; setState(0); } break; } case QEvent::KeyPress: { if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1, (const QKeyEvent *)e) ) { if ( state() == 0 ) { cmdList += Begin; cmdList += Append; setState(1); } else { cmdList += End; setState(0); } } break; } default: break; } return cmdList; }