{
public:
{
if ( e
->type
() == QEvent::MouseMove ) cmdList += Move;
return cmdList;
}
};
{
public:
{
setRubberBandPen
(QColor(Qt
::green));
canvas->setMouseTracking(true);
}
{
if ( !isActive() )
{
setSelectionFlags
(QwtPicker::PointSelection);
begin();
append(e->pos());
}
}
void widgetLeaveEvent
(QEvent *) {
end();
}
{
return new PickerMachine;
}
};
class PickerMachine: public QwtPickerMachine
{
public:
virtual QwtPickerMachine::CommandList transition(
const QwtEventPattern &, const QEvent *e)
{
QwtPickerMachine::CommandList cmdList;
if ( e->type() == QEvent::MouseMove )
cmdList += Move;
return cmdList;
}
};
class Picker: public QwtPlotPicker
{
public:
Picker(QwtPlotCanvas *canvas):
QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, canvas)
{
setRubberBand(QwtPlotPicker::CrossRubberBand);
setRubberBandPen(QColor(Qt::green));
setRubberBand(QwtPicker::CrossRubberBand);
canvas->setMouseTracking(true);
}
void widgetMouseMoveEvent(QMouseEvent *e)
{
if ( !isActive() )
{
setSelectionFlags(QwtPicker::PointSelection);
begin();
append(e->pos());
}
QwtPlotPicker::widgetMouseMoveEvent(e);
}
void widgetLeaveEvent(QEvent *)
{
end();
}
virtual QwtPickerMachine *stateMachine(int) const
{
return new PickerMachine;
}
};
To copy to clipboard, switch view to plain text mode
HTH,
Uwe
Bookmarks