MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / pixelsToCoords

Method pixelsToCoords

3rdparty/qcustomplot/qcustomplot.cpp:11671–11686  ·  view source on GitHub ↗

! 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 */

Source from the content-addressed store, hash-verified

11669 \see coordsToPixels, QCPAxis::coordToPixel
11670*/
11671void 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

Callers

nothing calls this directly

Calls 2

pixelToCoordMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected