Exactly the same things, only you don't have to create the plot.
Here's an example from my program:
// setup axis
_ui.
plot->setAxisTitle
( QwtPlot::xBottom, tr
( "Wavelength [nm]" ) );
...
_xAxis
= _ui.
plot->axisWidget
( QwtPlot::xBottom );
...
_xAxis->installEventFilter( this );
...
// create data and attach it to the plot
_curve.setData( _data );
_curve.
setRenderHint( QwtPlotItem::RenderAntialiased );
_curve.attach( _ui.plot );
_ui.plot->replot();
// create value picker
_picker
->setSelectionFlags
( QwtPicker::PointSelection |
_picker
->setRubberBand
( QwtPicker::CrossRubberBand );
_picker
->setTrackerMode
( QwtPicker::AlwaysOn );
_picker
->setTrackerFont
( QFont( "Helvetica",
10,
QFont::Bold ) );
// create zoomer
_zoomer
->setSelectionFlags
( QwtPicker::DragSelection );
_zoomer
->setTrackerMode
( QwtPicker::AlwaysOff );
connect( _picker, SIGNAL( moved(const QPoint& ) ),
this, SLOT( cursorMoved( const QPoint& ) ) );
connect( _picker, SIGNAL( selected( const QwtDoublePoint& ) ),
this, SLOT( pointSelected( const QwtDoublePoint& ) ) );
...
// setup axis
_ui.plot->setAxisTitle( QwtPlot::xBottom, tr( "Wavelength [nm]" ) );
...
_xAxis = _ui.plot->axisWidget( QwtPlot::xBottom );
...
_xAxis->installEventFilter( this );
...
// create data and attach it to the plot
_curve.setData( _data );
_curve.setRenderHint( QwtPlotItem::RenderAntialiased );
_curve.setYAxis( QwtPlot::yLeft );
_curve.attach( _ui.plot );
_ui.plot->replot();
// create value picker
_picker = new QwtPlotPicker( _ui.plot->canvas() );
_picker->setSelectionFlags( QwtPicker::PointSelection |
QwtPicker::DragSelection );
_picker->setRubberBand( QwtPicker::CrossRubberBand );
_picker->setTrackerMode( QwtPicker::AlwaysOn );
_picker->setTrackerFont( QFont( "Helvetica", 10, QFont::Bold ) );
// create zoomer
_zoomer = new QwtPlotZoomer( _ui.plot->canvas() );
_zoomer->setSelectionFlags( QwtPicker::DragSelection );
_zoomer->setTrackerMode( QwtPicker::AlwaysOff );
connect( _picker, SIGNAL( moved(const QPoint& ) ),
this, SLOT( cursorMoved( const QPoint& ) ) );
connect( _picker, SIGNAL( selected( const QwtDoublePoint& ) ),
this, SLOT( pointSelected( const QwtDoublePoint& ) ) );
...
To copy to clipboard, switch view to plain text mode
I use Qt4, so I have to access the plot using "_ui.plot". In Qt3 you will have to skip the "ui." part.
Bookmarks