! 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 */
| 10953 | \see coordsToPixels, QCPAxis::coordToPixel |
| 10954 | */ |
| 10955 | void QCPAbstractPlottable::pixelsToCoords(double x, double y, double &key, double &value) const |
| 10956 | { |
| 10957 | QCPAxis *keyAxis = mKeyAxis.data(); |
| 10958 | QCPAxis *valueAxis = mValueAxis.data(); |
| 10959 | if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } |
| 10960 | |
| 10961 | if (keyAxis->orientation() == Qt::Horizontal) |
| 10962 | { |
| 10963 | key = keyAxis->pixelToCoord(x); |
| 10964 | value = valueAxis->pixelToCoord(y); |
| 10965 | } else |
| 10966 | { |
| 10967 | key = keyAxis->pixelToCoord(y); |
| 10968 | value = valueAxis->pixelToCoord(x); |
| 10969 | } |
| 10970 | } |
| 10971 | |
| 10972 | /*! \overload |
| 10973 |
no test coverage detected