QCustomPlot Discussion and Comments

QCPColorMap - How to get cell (x/y) on mouse clickReturn to overview


Hi all,

I'm using QCPColorMap and want to get the coordinates of the data cell I click or double click on.
How can I do this ?

Best
Uwe

probably just call QCPAxis::pixelToCoord to get the grid coordinates and then you can call QCPColorMapData::data to get the value of that cell.

QCPColorMapData::cellToCoord and coordToCell might also be helpful.


Only to be sure, I have to subclass QCPColorMap to program my own mouseDoubleClickEvent method, right ?
There i could calculate the data cell.

It is probably easier to just use the plottableDoubleClick signal of QCustomPlot. (or mouseDoubleClick signal )


Ah, thinking too complicated... Using mouseDoubleClick is much easier !
Understanding a little more now, the problem is solved with

PlotXY->data()->coordToCell(PlotXY->keyAxis()->pixelToCoord(event->pos().x()),PlotXY->valueAxis()->pixelToCoord(event->pos().y()),&cellx,&celly);

Thank you very much !