diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-12-20 13:01:21 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-10 15:57:39 -0800 |
commit | bd01e91ea39c837677b543f1493e837d356cfaee (patch) | |
tree | 8fdfbaae27f06e6f7f63f73d12ed0c52fab33529 /profile-widget/divecartesianaxis.cpp | |
parent | 78196839903398434638073d26ee9b47da0a0e55 (diff) | |
download | subsurface-bd01e91ea39c837677b543f1493e837d356cfaee.tar.gz |
cleanup: make DiveCartesianAxis functions const
A few DiveCartesianAxis functions that were pure accessors
were not const. Make them so. Moreover, mark a few overridden
virtual functions as such.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/divecartesianaxis.cpp')
-rw-r--r-- | profile-widget/divecartesianaxis.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp index 40203b00f..944b636cc 100644 --- a/profile-widget/divecartesianaxis.cpp +++ b/profile-widget/divecartesianaxis.cpp @@ -9,7 +9,7 @@ #include "profile-widget/divelineitem.h" #include "profile-widget/profilewidget2.h" -QPen DiveCartesianAxis::gridPen() +QPen DiveCartesianAxis::gridPen() const { QPen pen; pen.setColor(getColor(TIME_GRID)); @@ -96,7 +96,7 @@ void DiveCartesianAxis::setOrientation(Orientation o) changed = true; } -QColor DiveCartesianAxis::colorForValue(double) +QColor DiveCartesianAxis::colorForValue(double) const { return QColor(Qt::black); } @@ -265,7 +265,7 @@ void DiveCartesianAxis::animateChangeLine(const QLineF &newLine) sizeChanged(); } -QString DiveCartesianAxis::textForValue(double value) +QString DiveCartesianAxis::textForValue(double value) const { return QString("%L1").arg(value, 0, 'g', 4); } @@ -297,7 +297,7 @@ qreal DiveCartesianAxis::valueAt(const QPointF &p) const return fraction * (max - min) + min; } -qreal DiveCartesianAxis::posAtValue(qreal value) +qreal DiveCartesianAxis::posAtValue(qreal value) const { QLineF m = line(); QPointF p = pos(); @@ -349,14 +349,14 @@ void DiveCartesianAxis::setColor(const QColor &color) setPen(defaultPen); } -QString DepthAxis::textForValue(double value) +QString DepthAxis::textForValue(double value) const { if (value == 0) return QString(); return get_depth_string(lrint(value), false, false); } -QColor DepthAxis::colorForValue(double) +QColor DepthAxis::colorForValue(double) const { return QColor(Qt::red); } @@ -382,12 +382,12 @@ TimeAxis::TimeAxis(ProfileWidget2 *widget) : DiveCartesianAxis(widget) { } -QColor TimeAxis::colorForValue(double) +QColor TimeAxis::colorForValue(double) const { return QColor(Qt::blue); } -QString TimeAxis::textForValue(double value) +QString TimeAxis::textForValue(double value) const { int nr = lrint(value) / 60; if (maximum() < 600) @@ -409,7 +409,7 @@ TemperatureAxis::TemperatureAxis(ProfileWidget2 *widget) : DiveCartesianAxis(wid { } -QString TemperatureAxis::textForValue(double value) +QString TemperatureAxis::textForValue(double value) const { return QString::number(mkelvin_to_C((int)value)); } |