From e19b71709de18bbd21e6567ebd1e2e44d6539fa4 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 19 Mar 2019 20:05:39 +0100 Subject: Cleanup: pass const-reference to RulerItem2::setPlotInfo() Instead of passing a pointer, pass a cons reference. This is more idiomatic and consistent with RulerNodeItem2::setPlotInfo(). Also make the reference passed to RulerNodeItem2::setPlotInfo() const, to make clear that the argument is copied. Signed-off-by: Berthold Stoeger --- profile-widget/profilewidget2.cpp | 2 +- profile-widget/ruleritem.cpp | 10 +++++----- profile-widget/ruleritem.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 156c456bc..5d282fd95 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -718,7 +718,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict cylinderPressureAxis->setMinimum(plotInfo.minpressure); cylinderPressureAxis->setMaximum(plotInfo.maxpressure); #ifndef SUBSURFACE_MOBILE - rulerItem->setPlotInfo(&plotInfo); + rulerItem->setPlotInfo(plotInfo); #endif #ifdef SUBSURFACE_MOBILE diff --git a/profile-widget/ruleritem.cpp b/profile-widget/ruleritem.cpp index c7b82a3c6..f489aa9dd 100644 --- a/profile-widget/ruleritem.cpp +++ b/profile-widget/ruleritem.cpp @@ -26,7 +26,7 @@ RulerNodeItem2::RulerNodeItem2() : setFlag(ItemIgnoresTransformations); } -void RulerNodeItem2::setPlotInfo(plot_info &info) +void RulerNodeItem2::setPlotInfo(const plot_info &info) { pInfo = info; entry = pInfo.entry; @@ -152,11 +152,11 @@ RulerNodeItem2 *RulerItem2::destNode() const return dest; } -void RulerItem2::setPlotInfo(plot_info *info) +void RulerItem2::setPlotInfo(const plot_info &info) { - pInfo = *info; - dest->setPlotInfo(*info); - source->setPlotInfo(*info); + pInfo = info; + dest->setPlotInfo(info); + source->setPlotInfo(info); dest->recalculate(); source->recalculate(); recalculate(); diff --git a/profile-widget/ruleritem.h b/profile-widget/ruleritem.h index 3462a5d35..2c7c5b3ea 100644 --- a/profile-widget/ruleritem.h +++ b/profile-widget/ruleritem.h @@ -18,7 +18,7 @@ class RulerNodeItem2 : public QObject, public QGraphicsEllipseItem { public: explicit RulerNodeItem2(); void setRuler(RulerItem2 *r); - void setPlotInfo(struct plot_info &info); + void setPlotInfo(const struct plot_info &info); void recalculate(); protected: @@ -37,7 +37,7 @@ public: explicit RulerItem2(); void recalculate(); - void setPlotInfo(struct plot_info *pInfo); + void setPlotInfo(const struct plot_info &pInfo); RulerNodeItem2 *sourceNode() const; RulerNodeItem2 *destNode() const; void setAxis(DiveCartesianAxis *time, DiveCartesianAxis *depth); -- cgit v1.2.3-70-g09d2