View Full Version : Making simple plot in qt designer using qwt library

17th April 2006, 20:01

I'm using Qt Designer and already have the qwt library and plugun's instaled!

How do i make a simple plot using QT designer, and qwtplot widget?

what i have to do? new slot's i think, but what i put there???

I can't find any manual that tell how to do it, in qt designer!

any help??!! Please!

Thanks best regards

17th April 2006, 20:14
I can't find any manual that tell how to do it, in qt designer!
You can't do it in the Qt Designer --- it's only an layout desiger, not IDE. You will have to write some code.

There are a lot of examples included in Qwt sources. Checkout ./examples/simple_plot and ./examples/bode.

19th April 2006, 11:15

I already see the examples, but i can't make anything with that!

If i use QT3 Designer, and in a form put a qwtplot plugin, my question is what i have to put in *.ui file to make it work!

it will be nice if sameone put here a simple example of how to do it a simple plot in qt designer using a qwtplot plugin

best regards

19th April 2006, 15:09
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.setYAxis( QwtPlot::yLeft );
_curve.attach( _ui.plot );


// 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& ) ) );
...I use Qt4, so I have to access the plot using "_ui.plot". In Qt3 you will have to skip the "ui." part.

10th October 2009, 17:59

i made a small app with qt desinger with a QwtPlot in it.

it's possible to do something like: :confused:

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow),
plot = new RandomPlot();
ui->qwtPlot = plot;

class RandomPlot : public QwtPlot

it compiles fine, but the plot isn't shown.

(i use qt4 and qwt 5.2.0)