diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/divecartesianaxis.cpp | 29 | ||||
-rw-r--r-- | qt-ui/profile/divecartesianaxis.h | 4 | ||||
-rw-r--r-- | qt-ui/profilegraphics.cpp | 1 |
3 files changed, 31 insertions, 3 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp index 4c7b608f8..fdcfff3c6 100644 --- a/qt-ui/profile/divecartesianaxis.cpp +++ b/qt-ui/profile/divecartesianaxis.cpp @@ -10,6 +10,13 @@ #include <QGraphicsView> #include <QStyleOption> +static QPen gridPen(){ + QPen pen; + pen.setColor(getColor(TIME_GRID)); + pen.setWidth(2); + pen.setCosmetic(true); + return pen; +} void DiveCartesianAxis::setMaximum(double maximum) { max = maximum; @@ -29,7 +36,7 @@ void DiveCartesianAxis::setTextColor(const QColor& color) DiveCartesianAxis::DiveCartesianAxis() : orientation(LeftToRight), showTicks(true), showText(true) { - + setPen(gridPen()); } DiveCartesianAxis::~DiveCartesianAxis() @@ -42,6 +49,11 @@ void DiveCartesianAxis::setOrientation(Orientation o) orientation = o; } +QColor DiveCartesianAxis::colorForValue(double value) +{ + return QColor(Qt::black); +} + void DiveCartesianAxis::updateTicks() { QLineF m = line(); @@ -108,6 +120,7 @@ void DiveCartesianAxis::updateTicks() label = new DiveTextItem(this); label->setText(textForValue(currValue)); label->setBrush(QBrush(textColor)); + label->setBrush(colorForValue(currValue)); } labels.push_back(label); if (orientation == RightToLeft || orientation == LeftToRight) { @@ -223,6 +236,18 @@ QString DepthAxis::textForValue(double value) return get_depth_string(value, false, false); } +QColor DepthAxis::colorForValue(double value) +{ + Q_UNUSED(value); + return QColor(Qt::red); +} + +QColor TimeAxis::colorForValue(double value) +{ + Q_UNUSED(value); + return QColor(Qt::blue); +} + QString TimeAxis::textForValue(double value) { return QString::number(value / 60); @@ -303,6 +328,7 @@ void DiveCartesianPlane::setup() line->setLine(0, 0, horizontalSize, 0); line->setPos(left,leftAxis->posAtValue(i)); line->setZValue(-1); + line->setPen(gridPen()); horizontalLines.push_back(line); scene()->addItem(line); } @@ -312,6 +338,7 @@ void DiveCartesianPlane::setup() line->setLine(0, 0, 0, verticalSize); line->setPos(bottomAxis->posAtValue(i), top); line->setZValue(-1); + line->setPen(gridPen()); verticalLines.push_back(line); scene()->addItem(line); } diff --git a/qt-ui/profile/divecartesianaxis.h b/qt-ui/profile/divecartesianaxis.h index e03df04e3..b2aecbf79 100644 --- a/qt-ui/profile/divecartesianaxis.h +++ b/qt-ui/profile/divecartesianaxis.h @@ -36,7 +36,7 @@ signals: void sizeChanged(); protected: virtual QString textForValue(double value); - + virtual QColor colorForValue(double value); Orientation orientation; QList<DiveTextItem*> labels; double min; @@ -51,11 +51,13 @@ protected: class DepthAxis : public DiveCartesianAxis { protected: QString textForValue(double value); + QColor colorForValue(double value); }; class TimeAxis : public DiveCartesianAxis { protected: QString textForValue(double value); + QColor colorForValue(double value); }; class TemperatureAxis : public DiveCartesianAxis{ diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 2d99e654f..454bca65a 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -362,7 +362,6 @@ QColor ProfileGraphicsView::getColor(const color_indice_t i) void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw) { - return; struct divecomputer *dc = NULL; if (d) |