summaryrefslogtreecommitdiffstats
path: root/src/charts/layout/abstractchartlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/charts/layout/abstractchartlayout.cpp')
-rw-r--r--src/charts/layout/abstractchartlayout.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/charts/layout/abstractchartlayout.cpp b/src/charts/layout/abstractchartlayout.cpp
index bfafd085..46689cab 100644
--- a/src/charts/layout/abstractchartlayout.cpp
+++ b/src/charts/layout/abstractchartlayout.cpp
@@ -65,7 +65,7 @@ void AbstractChartLayout::setGeometry(const QRectF &rect)
contentGeometry = calculateContentGeometry(contentGeometry);
- if (title && title->isVisible() && !title->text().isEmpty())
+ if (title && title->isVisible())
contentGeometry = calculateTitleGeometry(contentGeometry, title);
if (legend->isAttachedToChart() && legend->isVisible())
@@ -167,11 +167,15 @@ QRectF AbstractChartLayout::calculateLegendMinimum(const QRectF &geometry, QLege
QRectF AbstractChartLayout::calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const
{
title->setGeometry(geometry);
- // Round to full pixel via QPoint to avoid one pixel clipping on the edge in some cases
- QPointF center((geometry.center() - title->boundingRect().center()).toPoint());
-
- title->setPos(center.x(), title->pos().y());
- return geometry.adjusted(0, title->boundingRect().height()+1, 0, 0);
+ if (title->text().isEmpty()) {
+ return geometry;
+ } else {
+ // Round to full pixel via QPoint to avoid one pixel clipping on the edge in some cases
+ QPointF center((geometry.center() - title->boundingRect().center()).toPoint());
+
+ title->setPos(center.x(), title->pos().y());
+ return geometry.adjusted(0, title->boundingRect().height() + 1, 0, 0);
+ }
}
QRectF AbstractChartLayout::calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const