I try this with a example :
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////
//////////////// Tracer TEST .cpp
////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
// generate some data:
QVector<double> x(101), y(101); // initialize with entries 0..100
for (int i=0; i<101; ++i)
{
x[i] = i/50.0 - 1; // x goes from -1 to 1
y[i] = x[i]*x[i]; // let's plot a quadratic function
}
// create graph and assign data to it:
test_QCPGraph=ui->graph5->addGraph();
ui->graph5->graph(0)->addData(x,y);
tracer_test->setGraph(test_QCPGraph);
// give the axes some labels:
ui->graph5->xAxis->setLabel("x");
ui->graph5->yAxis->setLabel("y");
// set axes ranges, so we see all data:
ui->graph5->xAxis->setRange(-1, 1);
ui->graph5->yAxis->setRange(0, 1);
ui->graph5->replot();
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////
//////////////// Tracer TEST .h
////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
private :
QPointer<QCPGraph> test_QCPGraph;
QPointer<QCPItemTracer> tracer_test;
void QCPItemTracer::setGraph(QCPGraph *graph)
{
qDebug() << "curseur";
if (graph)
{
qDebug() << "curseur2";
if (graph->parentPlot() == mParentPlot)
{
qDebug() << "curseur3";
position->setType(QCPItemPosition::ptPlotCoords);
position->setAxes(graph->keyAxis(), graph->valueAxis());
mGraph = graph;
updatePosition();
} else
qDebug() << Q_FUNC_INFO << "graph isn't in same QCustomPlot instance as this item";
} else
{
qDebug() << "curseur4";
mGraph = 0;
}
}
and in my debug i have this error :
16:04:37: Starting C:\build-version9-Desktop_Qt_5_9_9_MinGW_32bit-Debug\debug\v12.exe ...
curseur
curseur2
16:04:40: Le programme s'est terminé subitement.
16:04:40: The process was ended forcefully.
16:04:40: C:\\build-version9-Desktop_Qt_5_9_9_MinGW_32bit-Debug\debug\v12.exe crashed.
where's the pangolin that makes me crash my code?