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
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++;
}
}
}
void CPlot:: mouseDoubleClickEvent(QMouseEvent *pEvent)
{
if(pEvent->button() == Qt::LeftButton)
{
if(m_iNumbergraphe < MAX_GRAPHE_NUMBER)
{
QwtPlotCurve *curve;
QVector<QPointF>* values;
values=new QVector<QPointF>();
curve = new QwtPlotCurve( "Entre "+QString::number(m_iNumbergraphe*(-2))+"et "+QString::number(m_iNumbergraphe*2) );
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++;
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks