Hi all, I've spent a few hours trying to figure this one out and I'm exhausted. If I have multiple axes with graphs in my plot, and I try to add a a QCPItemStraightLine to axes after the first one, they all end up on the first axis!
The code i'm using is like this:
QCPItemStraightLine* l = new QCPItemStraightLine(ui->plot);
l->point1->setType(QCPItemPosition::ptPlotCoords);
l->point2->setType(QCPItemPosition::ptPlotCoords);
l->point1->setAxes(graph->keyAxis(), graph->valueAxis());
l->point2->setAxes(graph->keyAxis(), graph->valueAxis());
l->point1->setCoords(0.0, value);
l->point2->setCoords(1.0, value);
where graph is one of ui->plot->graph(i), for i greater than 0.