Results 1 to 2 of 2

Thread: Problem with adding many curves in qwtplot on Realtime

  1. #1
    Join Date
    Dec 2013
    Location
    Jerada, Morroco
    Posts
    106
    Thanks
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question Problem with adding many curves in qwtplot on Realtime

    Hi... I'm working on an example of plotting on Real time and i have some problems, when i double click on the plot i can add one curve on the plot , but the problem is when i arrived on 5 curves and i want to add a new curve , the program crached.

    Here is my method that is responsable of adding curves
    Qt Code:
    1. void CPlot:: mouseDoubleClickEvent(QMouseEvent *pEvent)
    2. {
    3.  
    4. if(pEvent->button() == Qt::LeftButton)
    5. {
    6. if(m_iNumbergraphe < MAX_GRAPHE_NUMBER)
    7. {
    8. QwtPlotCurve *curve;
    9. QVector<QPointF>* values;
    10. values=new QVector<QPointF>();
    11. curve = new QwtPlotCurve( "Entre "+QString::number(m_iNumbergraphe*(-2))+"et "+QString::number(m_iNumbergraphe*2) );
    12. curve->setPen( Qt::GlobalColor(20- m_iNumbergraphe) );
    13. curve->attach( this );
    14. m_graphe[m_iNumbergraphe].pBuffer = new CBufferCirculaire();
    15. m_graphe[m_iNumbergraphe].pStyle = curve;
    16. m_graphe[m_iNumbergraphe].pPendingValues = values;
    17. cStat.initBuffers(m_graphe[m_iNumbergraphe].pBuffer,m_iNumbergraphe);
    18. showCurve( m_graphe[m_iNumbergraphe].pStyle, true );
    19. m_iNumbergraphe++;
    20. }
    21. }
    22. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by hassinoss; 22nd January 2014 at 11:53.

  2. #2
    Join Date
    Dec 2013
    Location
    Toronto, Canada
    Posts
    62
    Thanked 16 Times in 15 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Problem with adding many curves in qwtplot on Realtime

    when i arrived on 5 curves and i want to add a new curve , the program crached
    If m_iNumbergraphe is a member variable that is initialized to zero in the constructor, then

    curve->setPen( Qt::GlobalColor(20- m_iNumbergraphe) );

    will set the curve pen of the first curve added to transparent. Thus, the curve will be drawn but not seen..
    However, if m_iNumbergraphe is initialized to 1 in the constructor, the color of the first curve is darkYellow.

    Now if m_graphe is a container resize to MAX_GRAPHE_NUMBER and you start out with m_iNumbergraphe at 1, that's a crash.

    Let us know.... Need more info


    Added after 16 minutes:


    that's a crash
    Well.. I should not assume that's a crash without knowing more.

    Debug the code and provide more info...
    Last edited by Cah; 23rd January 2014 at 02:44.

Similar Threads

  1. Replies: 3
    Last Post: 18th January 2014, 10:35
  2. Replies: 3
    Last Post: 27th September 2012, 16:40
  3. Replies: 0
    Last Post: 7th July 2012, 12:32
  4. Lining up 3 curves of a QwtPlot
    By pihentagy in forum Qwt
    Replies: 2
    Last Post: 18th February 2011, 15:38
  5. Replies: 5
    Last Post: 18th March 2008, 17:11

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.