diff options
Diffstat (limited to 'src/charts/layout/abstractchartlayout.cpp')
-rw-r--r-- | src/charts/layout/abstractchartlayout.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/charts/layout/abstractchartlayout.cpp b/src/charts/layout/abstractchartlayout.cpp index 3826c75e..e5c3eb36 100644 --- a/src/charts/layout/abstractchartlayout.cpp +++ b/src/charts/layout/abstractchartlayout.cpp @@ -53,6 +53,7 @@ void AbstractChartLayout::setGeometry(const QRectF &rect) { if (!rect.isValid()) return; + // If the chart has a fixed geometry then don't update visually const bool updateLayout = (!m_presenter->isFixedGeometry() || m_presenter->geometry() == rect); if (m_presenter->chart()->isVisible()) { @@ -73,12 +74,14 @@ void AbstractChartLayout::setGeometry(const QRectF &rect) contentGeometry = calculateAxisGeometry(contentGeometry, axes, updateLayout); - m_presenter->setGeometry(contentGeometry); - if (updateLayout) { - if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian) - static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); - else - static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); + if (contentGeometry.isValid()) { + m_presenter->setGeometry(contentGeometry); + if (updateLayout) { + if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian) + static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); + else + static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); + } } } |