#4243 Grid Cross Plot: Make legend icons black & white when grouping is enabled and set size from font size

This commit is contained in:
Gaute Lindkvist
2019-03-28 20:09:25 +01:00
parent ee5935aad6
commit 75b0905e26
10 changed files with 113 additions and 6 deletions

View File

@@ -20,6 +20,7 @@
#include "RiuQwtPlotCurve.h"
#include "RiaCurveDataTools.h"
#include "RiaImageTools.h"
#include "RiuQwtSymbol.h"
#include "qwt_symbol.h"
@@ -59,6 +60,7 @@ RiuQwtPlotCurve::RiuQwtPlotCurve(const QString &title)
m_showErrorBars = true;
m_attachedToPlot = nullptr;
m_blackAndWhiteLegendIcon = false;
}
//--------------------------------------------------------------------------------------------------
@@ -371,6 +373,31 @@ void RiuQwtPlotCurve::setAppearance(LineStyleEnum lineStyle,
setStyle(curveStyle);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::setBlackAndWhiteLegendIcon(bool blackAndWhite)
{
m_blackAndWhiteLegendIcon = blackAndWhite;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtGraphic RiuQwtPlotCurve::legendIcon(int index, const QSizeF& size) const
{
QwtGraphic icon = QwtPlotCurve::legendIcon(index, size);
if (m_blackAndWhiteLegendIcon)
{
QImage image = icon.toImage();
RiaImageTools::makeGrayScale(image);
QPainter painter(&icon);
painter.drawImage(QPoint(0, 0), image);
}
return icon;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------