diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-02-15 22:43:27 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-15 17:30:25 -0800 |
commit | 883b25cea30727aac641f2809a14da38e2eb3e96 (patch) | |
tree | 551aa240286989dd28d6b180b4ca692b505da62a /qt-ui/profile/divecartesianaxis.cpp | |
parent | 38e25458ee9b92ecf170a458ec442d3e362ee5dc (diff) | |
download | subsurface-883b25cea30727aac641f2809a14da38e2eb3e96.tar.gz |
Create the grids.
Create the grids, and the way that they move is fabulous <3
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/divecartesianaxis.cpp')
-rw-r--r-- | qt-ui/profile/divecartesianaxis.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp index c47ff4a28..e176d4f73 100644 --- a/qt-ui/profile/divecartesianaxis.cpp +++ b/qt-ui/profile/divecartesianaxis.cpp @@ -65,7 +65,7 @@ DiveCartesianAxis::DiveCartesianAxis() : QObject(), labelScale(1.0), tick_size(0), textVisibility(true), - line_size(-1) + line_size(1) { setPen(gridPen()); } @@ -195,6 +195,32 @@ void DiveCartesianAxis::updateTicks() } } + // Add's the rest of the needed Ticks / Text. + for (int i = lines.size(); i < steps; i++, currValueText += interval) { + qreal childPos; + if (orientation == TopToBottom || orientation == LeftToRight) { + childPos = begin + i * stepSize; + } else { + childPos = begin - i * stepSize; + } + DiveLineItem *line = new DiveLineItem(this); + QPen pen; + pen.setBrush(getColor(TIME_GRID)); + pen.setCosmetic(true); + pen.setWidthF(2); + line->setPen(pen); + lines.push_back(line); + if (orientation == RightToLeft || orientation == LeftToRight) { + line->setLine(0,-line_size,0, 0); + line->animateMoveTo(childPos, m.y1()); + } else { + QPointF p1 = mapFromScene(3, 0); + QPointF p2 = mapFromScene(line_size, 0); + line->setLine(p1.x(), 0, p2.x(), 0); + line->animateMoveTo(m.x1(), childPos); + } + } + Q_FOREACH(DiveTextItem *item, labels){ item->setVisible(textVisibility); } |