Public Member Functions

QwtPickerDragPointMachine Class Reference

A state machine for point selections. More...

#include <qwt_picker_machine.h>

Inheritance diagram for QwtPickerDragPointMachine:
Inheritance graph
[legend]
Collaboration diagram for QwtPickerDragPointMachine:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual CommandList transition (const QwtEventPattern &, const QEvent *)
 Transition.

Detailed Description

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.


Member Function Documentation

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;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines