! 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
| 26582 | Pass \c nullptr as \a colorScale to disconnect the color scale from this color map again. |
| 26583 | */ |
| 26584 | void QCPColorMap::setColorScale(QCPColorScale *colorScale) |
| 26585 | { |
| 26586 | if (mColorScale) // unconnect signals from old color scale |
| 26587 | { |
| 26588 | disconnect(this, SIGNAL(dataRangeChanged(QCPRange)), mColorScale.data(), SLOT(setDataRange(QCPRange))); |
| 26589 | disconnect(this, SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), mColorScale.data(), SLOT(setDataScaleType(QCPAxis::ScaleType))); |
| 26590 | disconnect(this, SIGNAL(gradientChanged(QCPColorGradient)), mColorScale.data(), SLOT(setGradient(QCPColorGradient))); |
| 26591 | disconnect(mColorScale.data(), SIGNAL(dataRangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange))); |
| 26592 | disconnect(mColorScale.data(), SIGNAL(gradientChanged(QCPColorGradient)), this, SLOT(setGradient(QCPColorGradient))); |
| 26593 | disconnect(mColorScale.data(), SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType))); |
| 26594 | } |
| 26595 | mColorScale = colorScale; |
| 26596 | if (mColorScale) // connect signals to new color scale |
| 26597 | { |
| 26598 | setGradient(mColorScale.data()->gradient()); |
| 26599 | setDataRange(mColorScale.data()->dataRange()); |
| 26600 | setDataScaleType(mColorScale.data()->dataScaleType()); |
| 26601 | connect(this, SIGNAL(dataRangeChanged(QCPRange)), mColorScale.data(), SLOT(setDataRange(QCPRange))); |
| 26602 | connect(this, SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), mColorScale.data(), SLOT(setDataScaleType(QCPAxis::ScaleType))); |
| 26603 | connect(this, SIGNAL(gradientChanged(QCPColorGradient)), mColorScale.data(), SLOT(setGradient(QCPColorGradient))); |
| 26604 | connect(mColorScale.data(), SIGNAL(dataRangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange))); |
| 26605 | connect(mColorScale.data(), SIGNAL(gradientChanged(QCPColorGradient)), this, SLOT(setGradient(QCPColorGradient))); |
| 26606 | connect(mColorScale.data(), SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType))); |
| 26607 | } |
| 26608 | } |
| 26609 | |
| 26610 | /*! |
| 26611 | Sets the data range (\ref setDataRange) to span the minimum and maximum values that occur in the |