MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / setColorScale

Method setColorScale

qcustomplot.cpp:25794–25818  ·  view source on GitHub ↗

! Associates the color scale \a colorScale with this color map. This means that both the color scale and the color map synchronize their gradient, data range and data scale type (\ref setGradient, \ref setDataRange, \ref setDataScaleType). Multiple color maps can be associated with one single color scale. This causes the color maps to also synchronize those properties, via the mutual

Source from the content-addressed store, hash-verified

25792 Pass 0 as \a colorScale to disconnect the color scale from this color map again.
25793*/
25794void QCPColorMap::setColorScale(QCPColorScale *colorScale)
25795{
25796 if (mColorScale) // unconnect signals from old color scale
25797 {
25798 disconnect(this, SIGNAL(dataRangeChanged(QCPRange)), mColorScale.data(), SLOT(setDataRange(QCPRange)));
25799 disconnect(this, SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), mColorScale.data(), SLOT(setDataScaleType(QCPAxis::ScaleType)));
25800 disconnect(this, SIGNAL(gradientChanged(QCPColorGradient)), mColorScale.data(), SLOT(setGradient(QCPColorGradient)));
25801 disconnect(mColorScale.data(), SIGNAL(dataRangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange)));
25802 disconnect(mColorScale.data(), SIGNAL(gradientChanged(QCPColorGradient)), this, SLOT(setGradient(QCPColorGradient)));
25803 disconnect(mColorScale.data(), SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType)));
25804 }
25805 mColorScale = colorScale;
25806 if (mColorScale) // connect signals to new color scale
25807 {
25808 setGradient(mColorScale.data()->gradient());
25809 setDataRange(mColorScale.data()->dataRange());
25810 setDataScaleType(mColorScale.data()->dataScaleType());
25811 connect(this, SIGNAL(dataRangeChanged(QCPRange)), mColorScale.data(), SLOT(setDataRange(QCPRange)));
25812 connect(this, SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), mColorScale.data(), SLOT(setDataScaleType(QCPAxis::ScaleType)));
25813 connect(this, SIGNAL(gradientChanged(QCPColorGradient)), mColorScale.data(), SLOT(setGradient(QCPColorGradient)));
25814 connect(mColorScale.data(), SIGNAL(dataRangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange)));
25815 connect(mColorScale.data(), SIGNAL(gradientChanged(QCPColorGradient)), this, SLOT(setGradient(QCPColorGradient)));
25816 connect(mColorScale.data(), SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType)));
25817 }
25818}
25819
25820/*!
25821 Sets the data range (\ref setDataRange) to span the minimum and maximum values that occur in the

Callers

nothing calls this directly

Calls 2

dataMethod · 0.45
dataRangeMethod · 0.45

Tested by

no test coverage detected