@@ -46,28 +46,30 void AbstractChartLayout::setGeometry(const QRectF &rect) | |||
|
46 | 46 | if (!rect.isValid()) |
|
47 | 47 | return; |
|
48 | 48 | |
|
49 | QList<ChartAxisElement *> axes = m_presenter->axisItems(); | |
|
50 |
|
|
|
51 |
|
|
|
52 | ChartBackground *background = m_presenter->backgroundElement(); | |
|
49 | if (m_presenter->chart()->isVisible()) { | |
|
50 | QList<ChartAxisElement *> axes = m_presenter->axisItems(); | |
|
51 | ChartTitle *title = m_presenter->titleElement(); | |
|
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 | contentGeometry = calculateTitleGeometry(contentGeometry, title); | |
|
59 | if (title && title->isVisible()) | |
|
60 | contentGeometry = calculateTitleGeometry(contentGeometry, title); | |
|
60 | 61 | |
|
61 | if (legend->isAttachedToChart() && legend->isVisible()) | |
|
62 | contentGeometry = calculateLegendGeometry(contentGeometry, legend); | |
|
62 | if (legend->isAttachedToChart() && legend->isVisible()) | |
|
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 | if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian) | |
|
68 | static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); | |
|
69 | else | |
|
70 | static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); | |
|
67 | m_presenter->setGeometry(contentGeometry); | |
|
68 | if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian) | |
|
69 | static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); | |
|
70 | else | |
|
71 | static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); | |
|
72 | } | |
|
71 | 73 | |
|
72 | 74 | QGraphicsLayout::setGeometry(rect); |
|
73 | 75 | } |
General Comments 0
You need to be logged in to leave comments.
Login now