Results 1 to 6 of 6

Thread: list of QwtCurves

  1. #1
    Join Date
    Sep 2007
    Posts
    99
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question list of QwtCurves

    This may be a stupid q...
    Does QwtPlot keep a list of all attached curves ?
    If so...how can I get it ?
    If not ->

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: list of QwtCurves

    QwtPlot has a list of all attached items ( see QwtPlotDict::itemList() ). For all curves you have to filter it using Rtti_PlotCurve ( or a dynamic_cast, when you have rtti enabled ).

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    Carlton (4th September 2010)

  4. #3
    Join Date
    Sep 2007
    Posts
    99
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: list of QwtCurves

    thanks buddy...
    I have another problem (as usual ...)
    I have created mainwindow in Qt Designer and I have put a QwtPlot inside that mainwindow...
    It gets created as 1000x1000(X x Y) plot...
    When I attach some curves to it they get displayed nicely...with autoscale...
    But I have implemented QwtZoomer as in examples:
    Qt Code:
    1. class Zoomer: public QwtPlotZoomer
    2. {
    3.  
    4. public:
    5. Zoomer(int xAxis, int yAxis, QwtPlotCanvas *canvas)
    6. :QwtPlotZoomer(xAxis, yAxis, canvas)
    7. {
    8. setSelectionFlags(QwtPicker::DragSelection | QwtPicker::CornerToCorner);
    9. setTrackerMode(QwtPicker::AlwaysOff);
    10. setRubberBand(QwtPicker::NoRubberBand);
    11.  
    12. // RightButton: zoom out by 1
    13. // Ctrl+RightButton: zoom out to full size
    14. setMousePattern(QwtEventPattern::MouseSelect2,
    15. Qt::RightButton, Qt::ControlModifier);
    16.  
    17. setMousePattern(QwtEventPattern::MouseSelect3,
    18. Qt::RightButton);
    19. }
    20. };
    To copy to clipboard, switch view to plain text mode 

    It is connected through the tool button(toggle) to this slot:

    Qt Code:
    1. void MainWindow::enableZoomMode(bool on)
    2. {
    3. dataPanner->setEnabled(on);
    4.  
    5. dataZoomer[0]->setEnabled(on);
    6. dataZoomer[0]->zoom(0);
    7.  
    8. dataZoomer[1]->setEnabled(on);
    9. dataZoomer[1]->zoom(0);
    10.  
    11. dataPicker->setEnabled(!on);
    12. }
    To copy to clipboard, switch view to plain text mode 
    The problem with this zoomer is that even when curves are displayed ok...when I toggle zoom button WHEN THE VALUES the curves display are small the curves are upon this toggle decreased too much so they are somwhere in the left corner of the plot...I think it is because the graph is initially created as 1000x1000 and zoom causes that somehow(since the max X values are 8 and max Y values are 10 )...So does anyone know how to make this work so the curves wouldnt decrease so much ?
    Attached Images Attached Images

  5. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: list of QwtCurves

    Whenever you change the scales behind the back of the zoomer you have to reinitialize the zoomer: see QwtPlotZoomer::setZoomBase().

    Otherwise zooming out will return to the axes you had, when the zoomer was initialized the last time. In your case it is 1000x1000, what are the default axes ranges, because you created your zoomer before the first replot with data was done.

    Uwe

  6. The following 2 users say thank you to Uwe for this useful post:

    gyre (19th December 2007), pankaj.patil (12th June 2008)

  7. #5
    Join Date
    Sep 2007
    Posts
    99
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: list of QwtCurves

    Quote Originally Posted by Uwe View Post
    Whenever you change the scales behind the back of the zoomer you have to reinitialize the zoomer: see QwtPlotZoomer::setZoomBase().

    Otherwise zooming out will return to the axes you had, when the zoomer was initialized the last time. In your case it is 1000x1000, what are the default axes ranges, because you created your zoomer before the first replot with data was done.

    Uwe
    so every time the zoom button is toggled I have to call setZoomBase() on the zoomer ?

  8. #6
    Join Date
    Sep 2007
    Posts
    99
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: list of QwtCurves

    Quote Originally Posted by Uwe View Post
    QwtPlot has a list of all attached items ( see QwtPlotDict::itemList() ). For all curves you have to filter it using Rtti_PlotCurve ( or a dynamic_cast, when you have rtti enabled ).

    Uwe
    I thought this :
    Qt Code:
    1. plot->detachItems(QwtPlotItem::Rtti_PlotCurve, true);
    To copy to clipboard, switch view to plain text mode 
    will remove all item from plot...but it does nothing...
    I need to remove all curves from the plot...
    What should I do ?

Similar Threads

  1. Replies: 1
    Last Post: 22nd October 2007, 02:04
  2. QComboBox drop list button events
    By maird in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2007, 19:25
  3. Replies: 26
    Last Post: 21st July 2007, 21:34
  4. Highlight text in list box
    By Sheetal in forum Qt Tools
    Replies: 7
    Last Post: 9th April 2007, 11:24
  5. list of list
    By quickNitin in forum Newbie
    Replies: 1
    Last Post: 3rd July 2006, 08:11

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.