QCustomPlot Discussion and Comments

How to add a cursor to the Plot based on double mouse clickReturn to overview

I have a program that captures measurement readings and draws a plot. I need some suggestions/help on what would the best way to draw some custom shape or a large circle at a mouse click cordinates. I need this funcionality to indicate the important points of the graph. Lets say I have a very large graph and I just want to quickly indicate few important places by double clicking. I have made a quick paint demonstration about what are my expectations:
https://ibb.co/yQ26WWW

I have created a signal to detect mouseDoubleClick event:
connect(ui->customPlot, &QCustomPlot::mouseDoubleClick, this, &MainWindow::SavePoint);

Inside that function, I can read what coordinates are detected using the code below:

void MainWindow::SavePoint(QMouseEvent *event)
{
//Current
float x = ui->customPlot->xAxis->pixelToCoord(event->pos().x());
float y = ui->customPlot->yAxis->pixelToCoord(event->pos().y());

//Voltage
float x2 = ui->customPlot->xAxis2->pixelToCoord(event->pos().x());
float y2 = ui->customPlot->yAxis2->pixelToCoord(event->pos().y());

qDebug("Time = %.2f \n",x);
qDebug("Current detected = %.2f \n",y);
qDebug("Voltage detected = %.2f \n",y2);
ui->cursor1_edit->setText(QString("T:%1 , I:%2 , V:%3").arg(precision(x,1)).arg(precision(y,2)).arg(precision(y2,2)));

}

I just do not know how can I draw something on top of the plot and ensure it stays there as the graph is being moved around.


I have solved the issue by creating a seperate graph for cursors using

 addGraph 
method

and then I can add cursors with whatever style I want using the following logic:

customPlot->graph()->setScatterStyle(QCPScatterStyle(QPixmap("../sun.jpg")));