diff options
Diffstat (limited to 'qt-ui/profile/divecartesianaxis.cpp')
-rw-r--r-- | qt-ui/profile/divecartesianaxis.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp index a12175461..84ab8ffcf 100644 --- a/qt-ui/profile/divecartesianaxis.cpp +++ b/qt-ui/profile/divecartesianaxis.cpp @@ -27,6 +27,7 @@ void DiveCartesianAxis::setTextColor(const QColor& color) DiveCartesianAxis::DiveCartesianAxis() : orientation(Qt::Horizontal) { + } DiveCartesianAxis::~DiveCartesianAxis() @@ -50,8 +51,8 @@ void DiveCartesianAxis::updateTicks() double currValue = min; // Remove the uneeded Ticks / Texts. - if (ticks.size() > steps){ - while (ticks.size() > steps){ + if (ticks.size() > steps) { + while (ticks.size() > steps) { DiveLineItem *removedLine = ticks.takeLast(); removedLine->animatedHide(); DiveTextItem *removedText = labels.takeLast(); @@ -65,21 +66,20 @@ void DiveCartesianAxis::updateTicks() qreal end = orientation == Qt::Horizontal ? m.x2() : m.y2(); double stepSize = orientation == Qt::Horizontal ? (m.x2() - m.x1()) : (m.y2() - m.y1()); stepSize = stepSize / steps; - for(int i = 0, count = ticks.size(); i < count; i++, currValue += interval){ + for (int i = 0, count = ticks.size(); i < count; i++, currValue += interval) { qreal childPos = begin + i * stepSize; labels[i]->setText(textForValue(currValue)); - if ( orientation == Qt::Horizontal ){ + if ( orientation == Qt::Horizontal ) { ticks[i]->animateMoveTo(childPos, m.y1() + tickSize); labels[i]->animateMoveTo(childPos, m.y1() + tickSize); - } - else{ + } else { ticks[i]->animateMoveTo(m.x1() - tickSize, childPos); labels[i]->animateMoveTo(m.x1() - tickSize, childPos); } } // Add's the rest of the needed Ticks / Text. - for(int i = ticks.size(); i < steps; i++, currValue += interval){ + for (int i = ticks.size(); i < steps; i++, currValue += interval) { qreal childPos = begin + i * stepSize; DiveLineItem *item = new DiveLineItem(this); item->setPen(pen()); @@ -90,15 +90,14 @@ void DiveCartesianAxis::updateTicks() label->setBrush(QBrush(textColor)); labels.push_back(label); - if(orientation == Qt::Horizontal){ + if (orientation == Qt::Horizontal) { item->setLine(0, 0, 0, tickSize); item->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene item->animateMoveTo(childPos, m.y1() + tickSize); // anim it to scene. label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); label->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene); label->animateMoveTo(childPos, m.y1() + tickSize); - } - else{ + } else { item->setLine(0, 0, tickSize, 0); item->setPos(m.x1() - tickSize, scene()->sceneRect().height() + 10); item->animateMoveTo(m.x1() - tickSize, childPos); @@ -146,7 +145,7 @@ qreal DiveCartesianAxis::posAtValue(qreal value) m.y2() - m.y1(); double retValue = realSize * percent; retValue = (orientation == Qt::Horizontal) ? - retValue + m.x1() + p.x(): + retValue + m.x1() + p.x() : retValue + m.y1() + p.y(); return retValue; } @@ -186,5 +185,5 @@ QString DepthAxis::textForValue(double value) QString TimeAxis::textForValue(double value) { - return QString::number(value / 60); -}
\ No newline at end of file + return QString::number(value / 60); +} |