Results 1 to 5 of 5

Thread: Making simple plot in qt designer using qwt library

  1. #1
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Question Making simple plot in qt designer using qwt library

    Hi!

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Making simple plot in qt designer using qwt library

    Quote Originally Posted by toze3
    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.

  3. #3
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Making simple plot in qt designer using qwt library

    Thanks!

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Making simple plot in qt designer using qwt library

    Exactly the same things, only you don't have to create the plot.

    Here's an example from my program:
    Qt Code:
    1. // setup axis
    2. _ui.plot->setAxisTitle( QwtPlot::xBottom, tr( "Wavelength [nm]" ) );
    3. ...
    4. _xAxis = _ui.plot->axisWidget( QwtPlot::xBottom );
    5. ...
    6. _xAxis->installEventFilter( this );
    7. ...
    8. // create data and attach it to the plot
    9. _curve.setData( _data );
    10. _curve.setRenderHint( QwtPlotItem::RenderAntialiased );
    11. _curve.setYAxis( QwtPlot::yLeft );
    12. _curve.attach( _ui.plot );
    13.  
    14. _ui.plot->replot();
    15.  
    16. // create value picker
    17. _picker = new QwtPlotPicker( _ui.plot->canvas() );
    18. _picker->setSelectionFlags( QwtPicker::PointSelection |
    19. QwtPicker::DragSelection );
    20. _picker->setRubberBand( QwtPicker::CrossRubberBand );
    21. _picker->setTrackerMode( QwtPicker::AlwaysOn );
    22. _picker->setTrackerFont( QFont( "Helvetica", 10, QFont::Bold ) );
    23.  
    24. // create zoomer
    25. _zoomer = new QwtPlotZoomer( _ui.plot->canvas() );
    26. _zoomer->setSelectionFlags( QwtPicker::DragSelection );
    27. _zoomer->setTrackerMode( QwtPicker::AlwaysOff );
    28.  
    29. connect( _picker, SIGNAL( moved(const QPoint& ) ),
    30. this, SLOT( cursorMoved( const QPoint& ) ) );
    31.  
    32. connect( _picker, SIGNAL( selected( const QwtDoublePoint& ) ),
    33. this, SLOT( pointSelected( const QwtDoublePoint& ) ) );
    34. ...
    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.

  5. #5
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Making simple plot in qt designer using qwt library

    hi,

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

    it's possible to do something like:

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent), ui(new Ui::MainWindow),
    3. ...
    4. plot = new RandomPlot();
    5. ui->qwtPlot = plot;
    6. ...
    7. }
    8.  
    9. class RandomPlot : public QwtPlot
    10. {
    11. ...
    12. }
    To copy to clipboard, switch view to plain text mode 

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

    (i use qt4 and qwt 5.2.0)

Similar Threads

  1. use interesting QWT Library with QT3.X
    By raphaelf in forum Qwt
    Replies: 2
    Last Post: 23rd January 2006, 11:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.