##// END OF EJS Templates
Adds checkLayout call, when geometry of axis updated
Michal Klocek -
r1890:daeb29af4a46
parent child
Show More
@@ -131,6 +131,7 void AxisAnimation::updateCurrentValue (const QVariant &value )
131 Q_ASSERT(vector.count() != 0);
131 Q_ASSERT(vector.count() != 0);
132 m_axis->setLayout(vector);
132 m_axis->setLayout(vector);
133 m_axis->updateGeometry();
133 m_axis->updateGeometry();
134 m_axis->checkLayout();
134 }
135 }
135
136
136 }
137 }
@@ -120,6 +120,7 void ChartCategoryAxisX::updateGeometry()
120 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
120 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
121 lineItem->setLine(layout[i],m_rect.bottom(),layout[i], m_rect.bottom() + 5);
121 lineItem->setLine(layout[i],m_rect.bottom(),layout[i], m_rect.bottom() + 5);
122 }
122 }
123
123 }
124 }
124
125
125 void ChartCategoryAxisX::handleAxisUpdated()
126 void ChartCategoryAxisX::handleAxisUpdated()
@@ -129,6 +129,7 void ChartCategoryAxisY::updateGeometry()
129 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
129 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
130 lineItem->setLine(m_rect.left()-5,layout[i],m_rect.left(),layout[i]);
130 lineItem->setLine(m_rect.left()-5,layout[i],m_rect.left(),layout[i]);
131 }
131 }
132
132 }
133 }
133
134
134 void ChartCategoryAxisY::handleAxisUpdated()
135 void ChartCategoryAxisY::handleAxisUpdated()
@@ -26,6 +26,7
26 #include <qmath.h>
26 #include <qmath.h>
27 #include <QDateTime>
27 #include <QDateTime>
28 #include <QValueAxis>
28 #include <QValueAxis>
29 #include <QGraphicsLayout>
29
30
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31
32
@@ -138,6 +139,7 void ChartAxis::updateLayout(QVector<qreal> &layout)
138 else {
139 else {
139 setLayout(layout);
140 setLayout(layout);
140 updateGeometry();
141 updateGeometry();
142 checkLayout();
141 }
143 }
142 }
144 }
143
145
@@ -381,6 +383,17 void ChartAxis::createNumberLabels(QStringList &labels,qreal min, qreal max, int
381 }
383 }
382 }
384 }
383
385
386 void ChartAxis::checkLayout()
387 {
388 if(m_minWidth > m_rect.width()) {
389 presenter()->layout()->invalidate();
390 }
391
392 if(m_minHeight > m_rect.height()) {
393 presenter()->layout()->invalidate();
394 }
395 }
396
384 #include "moc_chartaxis_p.cpp"
397 #include "moc_chartaxis_p.cpp"
385
398
386 QTCOMMERCIALCHART_END_NAMESPACE
399 QTCOMMERCIALCHART_END_NAMESPACE
@@ -98,6 +98,7 protected:
98 virtual void updateGeometry() = 0;
98 virtual void updateGeometry() = 0;
99 virtual QVector<qreal> calculateLayout() const = 0;
99 virtual QVector<qreal> calculateLayout() const = 0;
100 void createNumberLabels(QStringList &labels,qreal min, qreal max,int ticks) const;
100 void createNumberLabels(QStringList &labels,qreal min, qreal max,int ticks) const;
101 void checkLayout();
101
102
102 public Q_SLOTS:
103 public Q_SLOTS:
103 virtual void handleAxisUpdated();
104 virtual void handleAxisUpdated();
@@ -107,6 +107,7 void ChartValueAxisX::updateGeometry()
107 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
107 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
108 lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5);
108 lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5);
109 }
109 }
110
110 }
111 }
111
112
112 void ChartValueAxisX::handleAxisUpdated()
113 void ChartValueAxisX::handleAxisUpdated()
@@ -112,6 +112,7 void ChartValueAxisY::updateGeometry()
112 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
112 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
113 lineItem->setLine(m_rect.left()-5,layout[i],m_rect.left(),layout[i]);
113 lineItem->setLine(m_rect.left()-5,layout[i],m_rect.left(),layout[i]);
114 }
114 }
115
115 }
116 }
116
117
117 void ChartValueAxisY::handleAxisUpdated()
118 void ChartValueAxisY::handleAxisUpdated()
General Comments 0
You need to be logged in to leave comments. Login now