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

Method updateLegendIcon

qcustomplot/qcustomplot.cpp:25861–25872  ·  view source on GitHub ↗

! Takes the current appearance of the color map and updates the legend icon, which is used to represent this color map in the legend (see \ref QCPLegend). The \a transformMode specifies whether the rescaling is done by a faster, low quality image scaling algorithm (Qt::FastTransformation) or by a slower, higher quality algorithm (Qt::SmoothTransformation). The current color map a

Source from the content-addressed store, hash-verified

25859 \see setDataRange
25860*/
25861void QCPColorMap::updateLegendIcon(Qt::TransformationMode transformMode, const QSize &thumbSize)
25862{
25863 if (mMapImage.isNull() && !data()->isEmpty())
25864 updateMapImage(); // try to update map image if it's null (happens if no draw has happened yet)
25865
25866 if (!mMapImage.isNull()) // might still be null, e.g. if data is empty, so check here again
25867 {
25868 bool mirrorX = (keyAxis()->orientation() == Qt::Horizontal ? keyAxis() : valueAxis())->rangeReversed();
25869 bool mirrorY = (valueAxis()->orientation() == Qt::Vertical ? valueAxis() : keyAxis())->rangeReversed();
25870 mLegendIcon = QPixmap::fromImage(mMapImage.mirrored(mirrorX, mirrorY)).scaled(thumbSize, Qt::KeepAspectRatio, transformMode);
25871 }
25872}
25873
25874/* inherits documentation from base class */
25875double QCPColorMap::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const

Callers

nothing calls this directly

Calls 4

dataFunction · 0.85
keyAxisFunction · 0.85
valueAxisFunction · 0.85
isEmptyMethod · 0.45

Tested by

no test coverage detected