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>
This commit is contained in:
Tomaz Canabrava 2014-02-15 22:43:27 -02:00 committed by Dirk Hohndel
parent 38e25458ee
commit 883b25cea3
2 changed files with 31 additions and 1 deletions

View file

@ -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);
}

View file

@ -124,6 +124,9 @@ void ProfileWidget2::setupItemOnScene()
profileYAxis->setMinimum(0);
profileYAxis->setTickInterval(M_OR_FT(10,30));
profileYAxis->setTickSize(1);
profileYAxis->setLineSize(96);
timeAxis->setLineSize(96);
gasYAxis->setOrientation(DiveCartesianAxis::BottomToTop);
gasYAxis->setTickInterval(1);
@ -131,6 +134,7 @@ void ProfileWidget2::setupItemOnScene()
gasYAxis->setMinimum(0);
gasYAxis->setModel(dataModel);
gasYAxis->setFontLabelScale(0.7);
gasYAxis->setLineSize(96);
temperatureAxis->setOrientation(DiveCartesianAxis::BottomToTop);
temperatureAxis->setTickSize(2);