summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-14 16:24:33 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-16 10:12:30 +0700
commit36475c1ee5e082a40cbb6562db756e57ca7648ad (patch)
tree28c15d98ee4123a7cee6d906d170dadf847a8efb /qt-ui
parentca979044d0477e07ba776a74d8cfcc1fe9ebfa40 (diff)
downloadsubsurface-36475c1ee5e082a40cbb6562db756e57ca7648ad.tar.gz
Moves the remaining ticks of the Axis to their correct position on update.
If the size of the Axis changed, this should move them smootly to their place. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index b31003f0b..dc99d1f88 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -58,6 +58,26 @@ void DiveCartesianAxis::updateTicks()
removedText->animatedHide();
}
}
+
+ // Move the remaining Ticks / Text to it's corerct position
+ // Regartind the possibly new values for the Axis
+ qreal begin = orientation == Qt::Horizontal ? m.x1() : m.y1();
+ 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){
+ qreal childPos = begin + i * stepSize;
+ labels[i]->setText(textForValue(currValue));
+ if ( orientation == Qt::Horizontal ){
+ ticks[i]->animateMoveTo(childPos, m.y1() + tickSize);
+ labels[i]->animateMoveTo(childPos, m.y1() + tickSize);
+ }
+ else{
+ ticks[i]->animateMoveTo(m.x1() - tickSize, childPos);
+ labels[i]->animateMoveTo(m.x1() - tickSize, childPos);
+ }
+ }
+
}
QString DiveCartesianAxis::textForValue(double value)