From bd55491f7b0f026402bc609236901edfeafed21f 2012-03-13 11:28:21 From: Michal Klocek Date: 2012-03-13 11:28:21 Subject: [PATCH] Fixes shades counter --- diff --git a/src/axis/axisitem.cpp b/src/axis/axisitem.cpp index 4994377..367f95a 100644 --- a/src/axis/axisitem.cpp +++ b/src/axis/axisitem.cpp @@ -254,7 +254,6 @@ void AxisItem::setLayout(QVector& layout) Q_ASSERT(labels.size() == ticksList.size()); Q_ASSERT(layout.size() == ticksList.size()); - Q_ASSERT(layout.size() == m_ticksCount); switch (m_type) { @@ -271,9 +270,9 @@ void AxisItem::setLayout(QVector& layout) QPointF center = labelItem->boundingRect().center(); labelItem->setTransformOriginPoint(center.x(), center.y()); labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); - if(i%2 && i+1 < layout.size() && i>1) { - QGraphicsRectItem *rectItem = static_cast(shades.at(i/2)); - rectItem->setRect(layout[i],m_rect.top(),layout[i+1]-layout[i],m_rect.height()); + if((i+1)%2 && i>1) { + QGraphicsRectItem *rectItem = static_cast(shades.at(i/2-1)); + rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); } lineItem = static_cast(axis.at(i+1)); lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5); @@ -294,9 +293,9 @@ void AxisItem::setLayout(QVector& layout) QPointF center = labelItem->boundingRect().center(); labelItem->setTransformOriginPoint(center.x(), center.y()); labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , layout[i]-center.y()); - if(i%2 && i+1 < layout.size() && i>1) { - QGraphicsRectItem *rectItem = static_cast(shades.at(i/2)); - rectItem->setRect(m_rect.left(),layout[i],m_rect.width(),layout[i]-layout[i+1]); + if((i+1)%2 && i>1) { + QGraphicsRectItem *rectItem = static_cast(shades.at(i/2-1)); + rectItem->setRect(m_rect.left(),layout[i-1],m_rect.width(),layout[i-1]-layout[i]); } lineItem = static_cast(axis.at(i+1)); lineItem->setLine(m_rect.left()-5,layout[i],m_rect.left(),layout[i]); diff --git a/src/axis/qchartaxis.cpp b/src/axis/qchartaxis.cpp index 3492743..b2b105e 100644 --- a/src/axis/qchartaxis.cpp +++ b/src/axis/qchartaxis.cpp @@ -34,9 +34,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn QPen QChartAxis::gridPen() const + \fn QPen QChartAxis::gridLinePen() const \brief Returns pen used to draw grid. - \sa setGridPen() + \sa setGridLinePen() */ /*!