From 0019f0f15db3842379052c6d164ce3645693db78 2012-02-20 15:50:34 From: Michal Klocek Date: 2012-02-20 15:50:34 Subject: [PATCH] Bugfix shades not updated aftet tick changed --- diff --git a/src/axisitem.cpp b/src/axisitem.cpp index a642ac8..0686f32 100644 --- a/src/axisitem.cpp +++ b/src/axisitem.cpp @@ -90,7 +90,6 @@ void AxisItem::updateItem(int count) if(i%2){ QGraphicsRectItem *rectItem = static_cast(shades.at(i/2)); rectItem->setRect(x,m_rect.top(),deltaX,m_rect.height()); - rectItem->setOpacity( 0.5 ); } } } @@ -114,7 +113,6 @@ void AxisItem::updateItem(int count) if(i%2){ QGraphicsRectItem *rectItem = static_cast(shades.at(i/2)); rectItem->setRect(m_rect.left(),y,m_rect.width(),deltaY); - } } } @@ -166,7 +164,7 @@ void AxisItem::handleAxisUpdate(QChartAxis* axis) setShadesBrush(axis->shadesBrush()); } -void AxisItem::handleLabelsChanged(const QStringList& labels) +void AxisItem::handleLabelsChanged(QChartAxis* axis,const QStringList& labels) { m_thicksList=labels; QList items = m_labels.childItems(); @@ -175,6 +173,7 @@ void AxisItem::handleLabelsChanged(const QStringList& labels) m_thicksList=labels; createItems(m_thicksList.size()); items = m_labels.childItems(); + handleAxisUpdate(axis); } Q_ASSERT(items.size()==m_thicksList.size()); diff --git a/src/axisitem_p.h b/src/axisitem_p.h index 4732df2..3c4bba1 100644 --- a/src/axisitem_p.h +++ b/src/axisitem_p.h @@ -51,7 +51,7 @@ public: public slots: void handleAxisUpdate(QChartAxis* axis); - void handleLabelsChanged(const QStringList& labels); + void handleLabelsChanged(QChartAxis* axis,const QStringList& labels); void handleGeometryChanged(const QRectF& size); protected: void updateItem(int count); diff --git a/src/chartdataset.cpp b/src/chartdataset.cpp index c8142c1..21cfc93 100644 --- a/src/chartdataset.cpp +++ b/src/chartdataset.cpp @@ -292,7 +292,7 @@ QStringList ChartDataSet::createLabels(QChartAxis* axis,qreal min, qreal max) QStringList labels; - int ticks = axis->ticksCount(); + int ticks = axis->ticksCount()-1; for(int i=0; i<= ticks; i++){ qreal value = min + (i * (max - min)/ ticks); diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index e14bc23..60c844b 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -186,7 +186,7 @@ void ChartPresenter::handleSeriesDomainChanged(QChartSeries* series, const Domai void ChartPresenter::handleAxisLabelsChanged(QChartAxis* axis,const QStringList& labels) { - m_axisItems.value(axis)->handleLabelsChanged(labels); + m_axisItems.value(axis)->handleLabelsChanged(axis,labels); } void ChartPresenter::setChartTheme(QChart::ChartTheme theme) diff --git a/src/qchartaxis.cpp b/src/qchartaxis.cpp index 819b26b..d7cfb3b 100644 --- a/src/qchartaxis.cpp +++ b/src/qchartaxis.cpp @@ -11,7 +11,7 @@ m_shadesVisible(true), m_shadesOpacity(1.0), m_min(0), m_max(0), -m_ticksCount(4) +m_ticksCount(5) { }