A picker machine for double clicks looks like this:
{
public:
DoubleClickMachine():
{
}
virtual QList<Command> transition(
{
QList<QwtPickerMachine::Command> cmdList;
if ( event
->type
() == QEvent::MouseButtonDblClick ) {
cmdList += Begin;
cmdList += Append;
cmdList += End;
}
return cmdList;
}
};
class DoubleClickMachine: public QwtPickerMachine
{
public:
DoubleClickMachine():
QwtPickerMachine( PointSelection )
{
}
virtual QList<Command> transition(
const QwtEventPattern &, const QEvent *event )
{
QList<QwtPickerMachine::Command> cmdList;
if ( event->type() == QEvent::MouseButtonDblClick )
{
cmdList += Begin;
cmdList += Append;
cmdList += End;
}
return cmdList;
}
};
To copy to clipboard, switch view to plain text mode
and
picker->setStateMachine( new DoubleClickMachine() );
connect( picker,
SIGNAL( selected
( const QPointF & ) ), ...
);
QwtPlotPicker *picker = new QwtPlotPicker( plot->canvas() );
picker->setStateMachine( new DoubleClickMachine() );
connect( picker, SIGNAL( selected( const QPointF & ) ), ... );
To copy to clipboard, switch view to plain text mode
Uwe
Bookmarks