summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-02-15 22:15:45 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-15 17:30:21 -0800
commit38e25458ee9b92ecf170a458ec442d3e362ee5dc (patch)
tree6ca22be78c3f83a09ceb3f15c74ef32e6b0bed9a /qt-ui
parent0c5fd7db8eac11d74d27098b6f38d22e174f5439 (diff)
downloadsubsurface-38e25458ee9b92ecf170a458ec442d3e362ee5dc.tar.gz
Change the axis update method to move the lines.
Change the axis update method to move the lines alongside the texts. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index c272ffe70..c47ff4a28 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -118,7 +118,8 @@ void DiveCartesianAxis::updateTicks()
// unused so far:
// QGraphicsView *view = scene()->views().first();
double steps = (max - min) / interval;
- double currValue = min;
+ double currValueText = min;
+ double currValueLine = min;
if (steps < 1)
return;
@@ -144,15 +145,12 @@ void DiveCartesianAxis::updateTicks()
}
stepSize = stepSize / steps;
- for (int i = 0, count = labels.size(); i < count; i++, currValue += interval) {
- qreal childPos;
- if (orientation == TopToBottom || orientation == LeftToRight) {
- childPos = begin + i * stepSize;
- } else {
- childPos = begin - i * stepSize;
- }
+ for (int i = 0, count = labels.size(); i < count; i++, currValueText += interval) {
+ qreal childPos = (orientation == TopToBottom || orientation == LeftToRight) ?
+ begin + i * stepSize :
+ begin - i * stepSize;
- labels[i]->setText(textForValue(currValue));
+ labels[i]->setText(textForValue(currValueText));
if ( orientation == LeftToRight || orientation == RightToLeft) {
labels[i]->animateMoveTo(childPos, m.y1() + tick_size);
} else {
@@ -160,8 +158,20 @@ void DiveCartesianAxis::updateTicks()
}
}
+ for (int i = 0, count = lines.size(); i < count; i++, currValueLine += interval) {
+ qreal childPos = (orientation == TopToBottom || orientation == LeftToRight) ?
+ begin + i * stepSize :
+ begin - i * stepSize;
+
+ if ( orientation == LeftToRight || orientation == RightToLeft) {
+ lines[i]->animateMoveTo(childPos, m.y1());
+ } else {
+ lines[i]->animateMoveTo(m.x1(), childPos);
+ }
+ }
+
// Add's the rest of the needed Ticks / Text.
- for (int i = labels.size(); i < steps; i++, currValue += interval) {
+ for (int i = labels.size(); i < steps; i++, currValueText += interval) {
qreal childPos;
if (orientation == TopToBottom || orientation == LeftToRight) {
childPos = begin + i * stepSize;
@@ -169,9 +179,9 @@ void DiveCartesianAxis::updateTicks()
childPos = begin - i * stepSize;
}
DiveTextItem *label = new DiveTextItem(this);
- label->setText(textForValue(currValue));
+ label->setText(textForValue(currValueText));
label->setBrush(QBrush(textColor));
- label->setBrush(colorForValue(currValue));
+ label->setBrush(colorForValue(currValueText));
label->setScale(fontLabelScale());
labels.push_back(label);
if (orientation == RightToLeft || orientation == LeftToRight) {