##// END OF EJS Templates
Bugfix shades not updated aftet tick changed
Michal Klocek -
r241:0019f0f15db3
parent child
Show More
@@ -90,7 +90,6 void AxisItem::updateItem(int count)
90 if(i%2){
90 if(i%2){
91 QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2));
91 QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2));
92 rectItem->setRect(x,m_rect.top(),deltaX,m_rect.height());
92 rectItem->setRect(x,m_rect.top(),deltaX,m_rect.height());
93 rectItem->setOpacity( 0.5 );
94 }
93 }
95 }
94 }
96 }
95 }
@@ -114,7 +113,6 void AxisItem::updateItem(int count)
114 if(i%2){
113 if(i%2){
115 QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2));
114 QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2));
116 rectItem->setRect(m_rect.left(),y,m_rect.width(),deltaY);
115 rectItem->setRect(m_rect.left(),y,m_rect.width(),deltaY);
117
118 }
116 }
119 }
117 }
120 }
118 }
@@ -166,7 +164,7 void AxisItem::handleAxisUpdate(QChartAxis* axis)
166 setShadesBrush(axis->shadesBrush());
164 setShadesBrush(axis->shadesBrush());
167 }
165 }
168
166
169 void AxisItem::handleLabelsChanged(const QStringList& labels)
167 void AxisItem::handleLabelsChanged(QChartAxis* axis,const QStringList& labels)
170 {
168 {
171 m_thicksList=labels;
169 m_thicksList=labels;
172 QList<QGraphicsItem*> items = m_labels.childItems();
170 QList<QGraphicsItem*> items = m_labels.childItems();
@@ -175,6 +173,7 void AxisItem::handleLabelsChanged(const QStringList& labels)
175 m_thicksList=labels;
173 m_thicksList=labels;
176 createItems(m_thicksList.size());
174 createItems(m_thicksList.size());
177 items = m_labels.childItems();
175 items = m_labels.childItems();
176 handleAxisUpdate(axis);
178 }
177 }
179
178
180 Q_ASSERT(items.size()==m_thicksList.size());
179 Q_ASSERT(items.size()==m_thicksList.size());
@@ -51,7 +51,7 public:
51
51
52 public slots:
52 public slots:
53 void handleAxisUpdate(QChartAxis* axis);
53 void handleAxisUpdate(QChartAxis* axis);
54 void handleLabelsChanged(const QStringList& labels);
54 void handleLabelsChanged(QChartAxis* axis,const QStringList& labels);
55 void handleGeometryChanged(const QRectF& size);
55 void handleGeometryChanged(const QRectF& size);
56 protected:
56 protected:
57 void updateItem(int count);
57 void updateItem(int count);
@@ -292,7 +292,7 QStringList ChartDataSet::createLabels(QChartAxis* axis,qreal min, qreal max)
292
292
293 QStringList labels;
293 QStringList labels;
294
294
295 int ticks = axis->ticksCount();
295 int ticks = axis->ticksCount()-1;
296
296
297 for(int i=0; i<= ticks; i++){
297 for(int i=0; i<= ticks; i++){
298 qreal value = min + (i * (max - min)/ ticks);
298 qreal value = min + (i * (max - min)/ ticks);
@@ -186,7 +186,7 void ChartPresenter::handleSeriesDomainChanged(QChartSeries* series, const Domai
186
186
187 void ChartPresenter::handleAxisLabelsChanged(QChartAxis* axis,const QStringList& labels)
187 void ChartPresenter::handleAxisLabelsChanged(QChartAxis* axis,const QStringList& labels)
188 {
188 {
189 m_axisItems.value(axis)->handleLabelsChanged(labels);
189 m_axisItems.value(axis)->handleLabelsChanged(axis,labels);
190 }
190 }
191
191
192 void ChartPresenter::setChartTheme(QChart::ChartTheme theme)
192 void ChartPresenter::setChartTheme(QChart::ChartTheme theme)
@@ -11,7 +11,7 m_shadesVisible(true),
11 m_shadesOpacity(1.0),
11 m_shadesOpacity(1.0),
12 m_min(0),
12 m_min(0),
13 m_max(0),
13 m_max(0),
14 m_ticksCount(4)
14 m_ticksCount(5)
15 {
15 {
16
16
17 }
17 }
General Comments 0
You need to be logged in to leave comments. Login now