Is there a way to get the mouse coordinates in the QChartView ? Preferably in axial units. The goal is to display the coordinates of the mouse by moving the mouse around on the graph so that the user can measure the constructed objects.
I could not find a built-in function for this on QChartView , so I am trying to use QChartView::mouseMoveEvent(QMouseEvent *event) to try to calculate the resulting position in the plot area. The problem is that I cannot get a link to the coordinate system of the area region. I tried using mapToScene , mapToItem and mapToParent , as well as the reverse mapFrom... for all the objects that I can capture to try to do this, but to no avail.
I found that QChartView::chart->childItems()[2] indeed a plot area, with the exception of the axis and axis labels. Then I can call QChartView::chart->childItems()[2]->setCursor(Qt::CrossCursor) to make a cross only in the plotting area, and not on neighboring objects. But still I'm not trying to do anything to correctly refer to this coordinate system of the object.
source share