Results 1 to 2 of 2

Thread: implement NoCurve in Qwt plot according to checkbox toggle

  1. #1
    Join Date
    Aug 2013
    Posts
    41
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default implement NoCurve in Qwt plot according to checkbox toggle

    Hi all,

    I have implmented plotting signals using Qwt.
    What I want to do is depending on the checkbox status, the current curve should appear or disappear.
    I have read about
    Qt Code:
    1. NoCurve
    To copy to clipboard, switch view to plain text mode 
    but I am not able to make it work in my program.

    I have the following lines for drawing curves(two signals):

    Qt Code:
    1. #include <qwt_plot_canvas.h>
    2. #include <qwt_plot_marker.h>
    3. #include <qwt_plot_curve.h>
    4. #include <qwt_plot_grid.h>
    5. #include <qwt_scale_widget.h>
    6.  
    7. Time plot::Timeplot (QWidget *parent )
    8. :QwtPlot(parent)
    9. {
    10. int k;
    11.  
    12. QVector<QPen> vColor;
    13. vColor.append(QPen(Qt::black));
    14. vColor.append(QPen(Qt::red));
    15.  
    16. QVector<QwtPlotCurve*> pPlotCurveTime;
    17.  
    18. for (k=0; k< 2; k++)
    19. {
    20. pPlotCurveTime[k]->setPen(vColor[k%vColor.count()]);
    21. }
    22.  
    23. /*--------- if Checkbox is on (set to true), run following lines of code ---------*/
    24. for (k=0; k< 2; k++)
    25. {
    26. pPlotCurveTime[k]->setRawSamples((const T_DOUBLE*) pPlotData->pdTimeAxis, pPlotData->ppdSignal[k], pPlotData->iSignalMemoryLength);
    27. }
    28. }
    To copy to clipboard, switch view to plain text mode 


    Now, if the Checkbox is toggled off (set to false), then the above plotted curve should disappear (similar to NoCurve).

    What should be done to achieve this goal?

    Please help! Thanks.
    Last edited by uz_qt; 29th August 2013 at 17:00.

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

    Default Re: implement NoCurve in Qwt plot according to checkbox toggle

    See QwtPlotItem::setVisisble( bool )

    Uwe

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

    uz_qt (1st September 2013)

Similar Threads

  1. Replies: 2
    Last Post: 5th April 2013, 05:58
  2. QSslSocket toggle certificates
    By raszewski in forum Qt Programming
    Replies: 5
    Last Post: 29th November 2012, 20:51
  3. How to get toggle action text?
    By sudhansu in forum Qt Programming
    Replies: 4
    Last Post: 29th May 2012, 12:57
  4. Replies: 4
    Last Post: 1st June 2011, 15:54
  5. How to toggle between 2 forms
    By safknw in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2006, 11:34

Tags for this Thread

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.