From 41c23dcb228f573b1d283a71c92c81220db53970 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 28 Aug 2021 20:15:57 +0200 Subject: [PATCH] profile: remove color parameter of DiveCartesianAxis::updateTicks() The grid color is saved on construction, no need to pass a parameter. Note that this fixes a bug where the color was passed as animation speed. Ooops. That's what you get from weak typing. Signed-off-by: Berthold Stoeger --- profile-widget/divecartesianaxis.cpp | 8 ++++---- profile-widget/divecartesianaxis.h | 4 ++-- profile-widget/profilescene.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp index cfda8f764..008d329a6 100644 --- a/profile-widget/divecartesianaxis.cpp +++ b/profile-widget/divecartesianaxis.cpp @@ -141,7 +141,7 @@ double DiveCartesianAxis::height() const return fm.height() + labelSpaceVertical * dpr; } -void DiveCartesianAxis::updateTicks(int animSpeed, color_index_t color) +void DiveCartesianAxis::updateTicks(int animSpeed) { if (!changed && !printMode) return; @@ -233,7 +233,7 @@ void DiveCartesianAxis::updateTicks(int animSpeed, color_index_t color) } DiveLineItem *line = new DiveLineItem(this); QPen pen = gridPen(); - pen.setBrush(getColor(color)); + pen.setBrush(getColor(gridColor)); line->setPen(pen); line->setZValue(0); lines.push_back(line); @@ -380,9 +380,9 @@ QString TimeAxis::textForValue(double value) const return QString::number(nr); } -void TimeAxis::updateTicks(int animSpeed, color_index_t color) +void TimeAxis::updateTicks(int animSpeed) { - DiveCartesianAxis::updateTicks(animSpeed, color); + DiveCartesianAxis::updateTicks(animSpeed); if (maximum() > 600) { for (int i = 0; i < labels.count(); i++) { labels[i]->setVisible(i % 2); diff --git a/profile-widget/divecartesianaxis.h b/profile-widget/divecartesianaxis.h index eae0f8b77..bf50a9dd8 100644 --- a/profile-widget/divecartesianaxis.h +++ b/profile-widget/divecartesianaxis.h @@ -51,7 +51,7 @@ public: void setLinesVisible(bool arg1); void setLineSize(qreal lineSize); void setLine(const QLineF& line); - virtual void updateTicks(int animSpeed, color_index_t color = TIME_GRID); + virtual void updateTicks(int animSpeed); double width() const; // only for vertical axes double height() const; // only for horizontal axes @@ -94,7 +94,7 @@ class TimeAxis : public DiveCartesianAxis { Q_OBJECT public: using DiveCartesianAxis::DiveCartesianAxis; - void updateTicks(int animSpeed, color_index_t color = TIME_GRID) override; + void updateTicks(int animSpeed) override; private: QString textForValue(double value) const override; QColor colorForValue(double value) const override; diff --git a/profile-widget/profilescene.cpp b/profile-widget/profilescene.cpp index 974b177e1..a4a8e4db2 100644 --- a/profile-widget/profilescene.cpp +++ b/profile-widget/profilescene.cpp @@ -530,14 +530,14 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM heartBeatAxis->setMinimum(heartBeatAxisMin); heartBeatAxis->setMaximum(heartBeatAxisMax + 1); heartBeatAxis->setTickInterval(heartBeatAxisTick); - heartBeatAxis->updateTicks(HR_AXIS); // this shows the ticks + heartBeatAxis->updateTicks(animSpeed); } heartBeatAxis->setVisible(prefs.hrgraph && plotInfo.maxhr); percentageAxis->setMinimum(0); percentageAxis->setMaximum(100); percentageAxis->setVisible(false); - percentageAxis->updateTicks(HR_AXIS); + percentageAxis->updateTicks(animSpeed); if (calcMax) timeAxis->setMaximum(maxtime);