From 9bde04feca05456f30606b8f75e2139227f95db2 Mon Sep 17 00:00:00 2001 From: Emil Sawicki Date: Sun, 6 Mar 2022 15:00:55 +0100 Subject: [PATCH] Fixed legend size when resizing font --- limereport/items/lrchartitem.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/limereport/items/lrchartitem.cpp b/limereport/items/lrchartitem.cpp index 2233765..357b8cb 100644 --- a/limereport/items/lrchartitem.cpp +++ b/limereport/items/lrchartitem.cpp @@ -215,7 +215,6 @@ void ChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, } } - painter->fillRect(diagramRect, Qt::yellow); paintChartTitle(painter, titleRect); if (m_showLegend) m_chart->paintChartLegend(painter,legendRect); @@ -677,7 +676,7 @@ void AbstractChart::prepareLegendToPaint(QRectF &legendRect, QPainter *painter) case ChartItem::LegendAlignBottomLeft: case ChartItem::LegendAlignBottomCenter: case ChartItem::LegendAlignBottomRight: { - const qreal maxWidth = legendRect.width() * 0.9; + const qreal maxWidth = legendRect.width() * 0.95; qreal legendWidth = std::accumulate(m_legendColumnWidths.cbegin(), m_legendColumnWidths.cend(), 0.0); if (legendWidth < maxWidth) { return; @@ -688,7 +687,6 @@ void AbstractChart::prepareLegendToPaint(QRectF &legendRect, QPainter *painter) legendWidth = std::accumulate(m_legendColumnWidths.cbegin(), m_legendColumnWidths.cend(), 0.0); } painter->setFont(tmpFont); - legendRect = calcChartLegendRect(tmpFont, legendRect, true, 0, 0); break; } case ChartItem::LegendAlignRightTop: @@ -1215,7 +1213,6 @@ QVector AbstractChart::legendColumnWidths() const void AbstractBarChart::paintChartLegend(QPainter *painter, QRectF legendRect) { prepareLegendToPaint(legendRect, painter); - // TODO_ES after calculating bottom legend size, handle difference of sizes painter->setPen(Qt::black); painter->setRenderHint(QPainter::Antialiasing,false); if (m_chartItem->drawLegendBorder())