mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
7819683990
commit
bd01e91ea3
2 changed files with 18 additions and 18 deletions
|
@ -9,7 +9,7 @@
|
||||||
#include "profile-widget/divelineitem.h"
|
#include "profile-widget/divelineitem.h"
|
||||||
#include "profile-widget/profilewidget2.h"
|
#include "profile-widget/profilewidget2.h"
|
||||||
|
|
||||||
QPen DiveCartesianAxis::gridPen()
|
QPen DiveCartesianAxis::gridPen() const
|
||||||
{
|
{
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setColor(getColor(TIME_GRID));
|
pen.setColor(getColor(TIME_GRID));
|
||||||
|
@ -96,7 +96,7 @@ void DiveCartesianAxis::setOrientation(Orientation o)
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor DiveCartesianAxis::colorForValue(double)
|
QColor DiveCartesianAxis::colorForValue(double) const
|
||||||
{
|
{
|
||||||
return QColor(Qt::black);
|
return QColor(Qt::black);
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ void DiveCartesianAxis::animateChangeLine(const QLineF &newLine)
|
||||||
sizeChanged();
|
sizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DiveCartesianAxis::textForValue(double value)
|
QString DiveCartesianAxis::textForValue(double value) const
|
||||||
{
|
{
|
||||||
return QString("%L1").arg(value, 0, 'g', 4);
|
return QString("%L1").arg(value, 0, 'g', 4);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ qreal DiveCartesianAxis::valueAt(const QPointF &p) const
|
||||||
return fraction * (max - min) + min;
|
return fraction * (max - min) + min;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal DiveCartesianAxis::posAtValue(qreal value)
|
qreal DiveCartesianAxis::posAtValue(qreal value) const
|
||||||
{
|
{
|
||||||
QLineF m = line();
|
QLineF m = line();
|
||||||
QPointF p = pos();
|
QPointF p = pos();
|
||||||
|
@ -349,14 +349,14 @@ void DiveCartesianAxis::setColor(const QColor &color)
|
||||||
setPen(defaultPen);
|
setPen(defaultPen);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DepthAxis::textForValue(double value)
|
QString DepthAxis::textForValue(double value) const
|
||||||
{
|
{
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
return QString();
|
return QString();
|
||||||
return get_depth_string(lrint(value), false, false);
|
return get_depth_string(lrint(value), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor DepthAxis::colorForValue(double)
|
QColor DepthAxis::colorForValue(double) const
|
||||||
{
|
{
|
||||||
return QColor(Qt::red);
|
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);
|
return QColor(Qt::blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TimeAxis::textForValue(double value)
|
QString TimeAxis::textForValue(double value) const
|
||||||
{
|
{
|
||||||
int nr = lrint(value) / 60;
|
int nr = lrint(value) / 60;
|
||||||
if (maximum() < 600)
|
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));
|
return QString::number(mkelvin_to_C((int)value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class DiveCartesianAxis : public QObject, public QGraphicsLineItem {
|
||||||
Q_PROPERTY(qreal y WRITE setY READ y)
|
Q_PROPERTY(qreal y WRITE setY READ y)
|
||||||
private:
|
private:
|
||||||
bool printMode;
|
bool printMode;
|
||||||
QPen gridPen();
|
QPen gridPen() const;
|
||||||
public:
|
public:
|
||||||
enum Orientation {
|
enum Orientation {
|
||||||
TopToBottom,
|
TopToBottom,
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
double maximum() const;
|
double maximum() const;
|
||||||
double fontLabelScale() const;
|
double fontLabelScale() const;
|
||||||
qreal valueAt(const QPointF &p) const;
|
qreal valueAt(const QPointF &p) const;
|
||||||
qreal posAtValue(qreal value);
|
qreal posAtValue(qreal value) const;
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
void setTextColor(const QColor &color);
|
void setTextColor(const QColor &color);
|
||||||
void animateChangeLine(const QLineF &newLine);
|
void animateChangeLine(const QLineF &newLine);
|
||||||
|
@ -60,8 +60,8 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ProfileWidget2 *profileWidget;
|
ProfileWidget2 *profileWidget;
|
||||||
virtual QString textForValue(double value);
|
virtual QString textForValue(double value) const;
|
||||||
virtual QColor colorForValue(double value);
|
virtual QColor colorForValue(double value) const;
|
||||||
Orientation orientation;
|
Orientation orientation;
|
||||||
QList<DiveTextItem *> labels;
|
QList<DiveTextItem *> labels;
|
||||||
QList<DiveLineItem *> lines;
|
QList<DiveLineItem *> lines;
|
||||||
|
@ -82,8 +82,8 @@ class DepthAxis : public DiveCartesianAxis {
|
||||||
public:
|
public:
|
||||||
DepthAxis(ProfileWidget2 *widget);
|
DepthAxis(ProfileWidget2 *widget);
|
||||||
private:
|
private:
|
||||||
QString textForValue(double value);
|
QString textForValue(double value) const override;
|
||||||
QColor colorForValue(double value);
|
QColor colorForValue(double value) const override;
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
@ -95,8 +95,8 @@ public:
|
||||||
TimeAxis(ProfileWidget2 *widget);
|
TimeAxis(ProfileWidget2 *widget);
|
||||||
void updateTicks(color_index_t color = TIME_GRID);
|
void updateTicks(color_index_t color = TIME_GRID);
|
||||||
private:
|
private:
|
||||||
QString textForValue(double value);
|
QString textForValue(double value) const override;
|
||||||
QColor colorForValue(double value);
|
QColor colorForValue(double value) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TemperatureAxis : public DiveCartesianAxis {
|
class TemperatureAxis : public DiveCartesianAxis {
|
||||||
|
@ -104,7 +104,7 @@ class TemperatureAxis : public DiveCartesianAxis {
|
||||||
public:
|
public:
|
||||||
TemperatureAxis(ProfileWidget2 *widget);
|
TemperatureAxis(ProfileWidget2 *widget);
|
||||||
private:
|
private:
|
||||||
QString textForValue(double value);
|
QString textForValue(double value) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PartialGasPressureAxis : public DiveCartesianAxis {
|
class PartialGasPressureAxis : public DiveCartesianAxis {
|
||||||
|
|
Loading…
Add table
Reference in a new issue