##// END OF EJS Templates
Fix ChartView visibility change drawing...
Titta Heikkala -
r2605:23dc25e6ce18
parent child
Show More
@@ -46,28 +46,30 void AbstractChartLayout::setGeometry(const QRectF &rect)
46 if (!rect.isValid())
46 if (!rect.isValid())
47 return;
47 return;
48
48
49 QList<ChartAxisElement *> axes = m_presenter->axisItems();
49 if (m_presenter->chart()->isVisible()) {
50 ChartTitle *title = m_presenter->titleElement();
50 QList<ChartAxisElement *> axes = m_presenter->axisItems();
51 QLegend *legend = m_presenter->legend();
51 ChartTitle *title = m_presenter->titleElement();
52 ChartBackground *background = m_presenter->backgroundElement();
52 QLegend *legend = m_presenter->legend();
53 ChartBackground *background = m_presenter->backgroundElement();
53
54
54 QRectF contentGeometry = calculateBackgroundGeometry(rect, background);
55 QRectF contentGeometry = calculateBackgroundGeometry(rect, background);
55
56
56 contentGeometry = calculateContentGeometry(contentGeometry);
57 contentGeometry = calculateContentGeometry(contentGeometry);
57
58
58 if (title && title->isVisible())
59 if (title && title->isVisible())
59 contentGeometry = calculateTitleGeometry(contentGeometry, title);
60 contentGeometry = calculateTitleGeometry(contentGeometry, title);
60
61
61 if (legend->isAttachedToChart() && legend->isVisible())
62 if (legend->isAttachedToChart() && legend->isVisible())
62 contentGeometry = calculateLegendGeometry(contentGeometry, legend);
63 contentGeometry = calculateLegendGeometry(contentGeometry, legend);
63
64
64 contentGeometry = calculateAxisGeometry(contentGeometry, axes);
65 contentGeometry = calculateAxisGeometry(contentGeometry, axes);
65
66
66 m_presenter->setGeometry(contentGeometry);
67 m_presenter->setGeometry(contentGeometry);
67 if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian)
68 if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian)
68 static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
69 static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
69 else
70 else
70 static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
71 static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
72 }
71
73
72 QGraphicsLayout::setGeometry(rect);
74 QGraphicsLayout::setGeometry(rect);
73 }
75 }
@@ -518,7 +518,9 void QLegendPrivate::handleSeriesVisibleChanged()
518 marker->setVisible(series->isVisible());
518 marker->setVisible(series->isVisible());
519 }
519 }
520 }
520 }
521 m_layout->invalidate();
521
522 if (m_chart->isVisible())
523 m_layout->invalidate();
522 }
524 }
523
525
524 void QLegendPrivate::handleCountChanged()
526 void QLegendPrivate::handleCountChanged()
General Comments 0
You need to be logged in to leave comments. Login now