@@ -273,12 +273,12 void Axis::setLayout(QVector<qreal> &layout) | |||||
273 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); |
|
273 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); | |
274 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); |
|
274 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); | |
275 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); |
|
275 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); | |
276 | if (!categories) { |
|
276 | if (!categories || i<1) { | |
277 | labelItem->setText(ticksList.at(i)); |
|
277 | labelItem->setText(ticksList.at(i)); | |
278 | QPointF center = labelItem->boundingRect().center(); |
|
278 | QPointF center = labelItem->boundingRect().center(); | |
279 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
279 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
280 | labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); |
|
280 | labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); | |
281 |
} else |
|
281 | } else { | |
282 | labelItem->setText(ticksList.at(i)); |
|
282 | labelItem->setText(ticksList.at(i)); | |
283 | QPointF center = labelItem->boundingRect().center(); |
|
283 | QPointF center = labelItem->boundingRect().center(); | |
284 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
284 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
@@ -305,12 +305,12 void Axis::setLayout(QVector<qreal> &layout) | |||||
305 | lineItem->setLine(m_rect.left() , layout[i], m_rect.right(), layout[i]); |
|
305 | lineItem->setLine(m_rect.left() , layout[i], m_rect.right(), layout[i]); | |
306 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); |
|
306 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); | |
307 |
|
307 | |||
308 | if (!categories) { |
|
308 | if (!categories || i<1) { | |
309 | labelItem->setText(ticksList.at(i)); |
|
309 | labelItem->setText(ticksList.at(i)); | |
310 | QPointF center = labelItem->boundingRect().center(); |
|
310 | QPointF center = labelItem->boundingRect().center(); | |
311 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
311 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
312 | labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , layout[i]-center.y()); |
|
312 | labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , layout[i]-center.y()); | |
313 |
} else |
|
313 | } else { | |
314 | labelItem->setText(ticksList.at(i)); |
|
314 | labelItem->setText(ticksList.at(i)); | |
315 | QPointF center = labelItem->boundingRect().center(); |
|
315 | QPointF center = labelItem->boundingRect().center(); | |
316 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
316 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
General Comments 0
You need to be logged in to leave comments.
Login now