mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4542 Bring highlighted curve to the top and stop altering color of selected curve
This commit is contained in:
@@ -263,22 +263,10 @@ void RiuQwtPlot::highlightCurve(const QwtPlotCurve* closestCurve)
|
|||||||
symbolLineColor = symbol->pen().color();
|
symbolLineColor = symbol->pen().color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double zValue = plotCurve->z();
|
||||||
if (plotCurve == closestCurve)
|
if (plotCurve == closestCurve)
|
||||||
{
|
{
|
||||||
cvf::Color3f cvfBgColor = RiaColorTools::fromQColorTo3f(bgColor);
|
plotCurve->setZ(zValue + 100.0);
|
||||||
cvf::Color3f cvfFgColor = RiaColorTools::contrastColor(cvfBgColor);
|
|
||||||
QColor fgColor = RiaColorTools::toQColor(cvfFgColor);
|
|
||||||
|
|
||||||
QColor blendedColor = RiaColorTools::blendQColors(fgColor, curveColor, 1, 2);
|
|
||||||
QColor blendedSymbolColor = RiaColorTools::blendQColors(fgColor, symbolColor, 1, 2);
|
|
||||||
QColor blendedSymbolLineColor = RiaColorTools::blendQColors(fgColor, symbolLineColor, 1, 2);
|
|
||||||
|
|
||||||
plotCurve->setPen(blendedColor, existingPen.width(), existingPen.style());
|
|
||||||
if (symbol)
|
|
||||||
{
|
|
||||||
symbol->setColor(blendedSymbolColor);
|
|
||||||
symbol->setPen(blendedSymbolLineColor, symbol->pen().width(), symbol->pen().style());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -295,6 +283,7 @@ void RiuQwtPlot::highlightCurve(const QwtPlotCurve* closestCurve)
|
|||||||
}
|
}
|
||||||
CurveColors curveColors = {curveColor, symbolColor, symbolLineColor};
|
CurveColors curveColors = {curveColor, symbolColor, symbolLineColor};
|
||||||
m_originalCurveColors.insert(std::make_pair(plotCurve, curveColors));
|
m_originalCurveColors.insert(std::make_pair(plotCurve, curveColors));
|
||||||
|
m_originalZValues.insert(std::make_pair(plotCurve, zValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,8 +300,10 @@ void RiuQwtPlot::resetCurveHighlighting()
|
|||||||
{
|
{
|
||||||
const QPen& existingPen = plotCurve->pen();
|
const QPen& existingPen = plotCurve->pen();
|
||||||
auto colors = m_originalCurveColors[plotCurve];
|
auto colors = m_originalCurveColors[plotCurve];
|
||||||
|
double zValue = m_originalZValues[plotCurve];
|
||||||
|
|
||||||
plotCurve->setPen(colors.lineColor, existingPen.width(), existingPen.style());
|
plotCurve->setPen(colors.lineColor, existingPen.width(), existingPen.style());
|
||||||
|
plotCurve->setZ(zValue);
|
||||||
QwtSymbol* symbol = const_cast<QwtSymbol*>(plotCurve->symbol());
|
QwtSymbol* symbol = const_cast<QwtSymbol*>(plotCurve->symbol());
|
||||||
if (symbol)
|
if (symbol)
|
||||||
{
|
{
|
||||||
@@ -322,6 +313,7 @@ void RiuQwtPlot::resetCurveHighlighting()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_originalCurveColors.clear();
|
m_originalCurveColors.clear();
|
||||||
|
m_originalZValues.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@@ -86,5 +86,6 @@ private:
|
|||||||
QPointer<QwtPlotZoomer> m_zoomerRight;
|
QPointer<QwtPlotZoomer> m_zoomerRight;
|
||||||
|
|
||||||
std::map<QwtPlotCurve*, CurveColors> m_originalCurveColors;
|
std::map<QwtPlotCurve*, CurveColors> m_originalCurveColors;
|
||||||
|
std::map<QwtPlotCurve*, double> m_originalZValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user