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
Code:
void CPlot
:: mouseDoubleClickEvent(QMouseEvent *pEvent
) {
if(pEvent->button() == Qt::LeftButton)
{
if(m_iNumbergraphe < MAX_GRAPHE_NUMBER)
{
QVector<QPointF>* values;
values=new QVector<QPointF>();
curve->setPen( Qt::GlobalColor(20- m_iNumbergraphe) );
curve->attach( this );
m_graphe[m_iNumbergraphe].pBuffer = new CBufferCirculaire();
m_graphe[m_iNumbergraphe].pStyle = curve;
m_graphe[m_iNumbergraphe].pPendingValues = values;
cStat.initBuffers(m_graphe[m_iNumbergraphe].pBuffer,m_iNumbergraphe);
showCurve( m_graphe[m_iNumbergraphe].pStyle, true );
m_iNumbergraphe++;
}
}
}
Re: Problem with adding many curves in qwtplot on Realtime
Quote:
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:
Well.. I should not assume that's a crash without knowing more.
Debug the code and provide more info...