! Convenience function for transforming a x/y pixel pair on the QCustomPlot surface to plot coordinates, taking the orientations of the axes associated with this plottable into account (e.g. whether key represents x or y). \a x and \a y are transformed to the plot coodinates and are written to \a key and \a value. \see coordsToPixels, QCPAxis::coordToPixel */
| 11669 | \see coordsToPixels, QCPAxis::coordToPixel |
| 11670 | */ |
| 11671 | void QCPAbstractPlottable::pixelsToCoords(double x, double y, double &key, double &value) const |
| 11672 | { |
| 11673 | QCPAxis *keyAxis = mKeyAxis.data(); |
| 11674 | QCPAxis *valueAxis = mValueAxis.data(); |
| 11675 | if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } |
| 11676 | |
| 11677 | if (keyAxis->orientation() == Qt::Horizontal) |
| 11678 | { |
| 11679 | key = keyAxis->pixelToCoord(x); |
| 11680 | value = valueAxis->pixelToCoord(y); |
| 11681 | } else |
| 11682 | { |
| 11683 | key = keyAxis->pixelToCoord(y); |
| 11684 | value = valueAxis->pixelToCoord(x); |
| 11685 | } |
| 11686 | } |
| 11687 | |
| 11688 | /*! \overload |
| 11689 |
nothing calls this directly
no test coverage detected