MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / selectionHitBox

Method selectionHitBox

qcustomplot/qcustomplot.cpp:27076–27090  ·  view source on GitHub ↗

! \internal Returns the hit box in pixel coordinates that will be used for data selection with the selection rect (\ref selectTestRect), of the data point given by \a it. */

Source from the content-addressed store, hash-verified

27074 rect (\ref selectTestRect), of the data point given by \a it.
27075*/
27076QRectF QCPFinancial::selectionHitBox(QCPFinancialDataContainer::const_iterator it) const
27077{
27078 QCPAxis *keyAxis = mKeyAxis.data();
27079 QCPAxis *valueAxis = mValueAxis.data();
27080 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QRectF(); }
27081
27082 double keyPixel = keyAxis->coordToPixel(it->key);
27083 double highPixel = valueAxis->coordToPixel(it->high);
27084 double lowPixel = valueAxis->coordToPixel(it->low);
27085 double keyWidthPixels = keyPixel-keyAxis->coordToPixel(it->key-mWidth*0.5);
27086 if (keyAxis->orientation() == Qt::Horizontal)
27087 return QRectF(keyPixel-keyWidthPixels, highPixel, keyWidthPixels*2, lowPixel-highPixel).normalized();
27088 else
27089 return QRectF(highPixel, keyPixel-keyWidthPixels, lowPixel-highPixel, keyWidthPixels*2).normalized();
27090}
27091/* end of 'src/plottables/plottable-financial.cpp' */
27092
27093

Callers

nothing calls this directly

Calls 3

dataMethod · 0.80
coordToPixelMethod · 0.80
normalizedMethod · 0.80

Tested by

no test coverage detected