Cleanup: Remove superfluous QString constructions in divetripmodel.cpp

Remove superfluous QString constructions in a couple of simple functions
in divetripmodel.cpp

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2018-02-27 07:06:39 +01:00 committed by Robert C. Helling
parent aacc688670
commit 93ddcce6fa

View file

@ -369,19 +369,17 @@ QString DiveItem::displayDuration() const
QString DiveItem::displayTemperature() const QString DiveItem::displayTemperature() const
{ {
QString str;
struct dive *dive = get_dive_by_uniq_id(diveId); struct dive *dive = get_dive_by_uniq_id(diveId);
if (!dive->watertemp.mkelvin) if (!dive->watertemp.mkelvin)
return str; return QString();
return get_temperature_string(dive->watertemp, false); return get_temperature_string(dive->watertemp, false);
} }
QString DiveItem::displayTemperatureWithUnit() const QString DiveItem::displayTemperatureWithUnit() const
{ {
QString str;
struct dive *dive = get_dive_by_uniq_id(diveId); struct dive *dive = get_dive_by_uniq_id(diveId);
if (!dive->watertemp.mkelvin) if (!dive->watertemp.mkelvin)
return str; return QString();
return get_temperature_string(dive->watertemp, true); return get_temperature_string(dive->watertemp, true);
} }
@ -403,14 +401,12 @@ QString DiveItem::displaySacWithUnit() const
QString DiveItem::displayWeight() const QString DiveItem::displayWeight() const
{ {
QString str = weight_string(weight()); return weight_string(weight());
return str;
} }
QString DiveItem::displayWeightWithUnit() const QString DiveItem::displayWeightWithUnit() const
{ {
QString str = weight_string(weight()) + ((get_units()->weight == units::KG) ? tr("kg") : tr("lbs")); return weight_string(weight()) + ((get_units()->weight == units::KG) ? tr("kg") : tr("lbs"));
return str;
} }
int DiveItem::weight() const int DiveItem::weight() const