summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveInformation.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-04 16:04:36 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-06 07:00:34 +0900
commit4e7adcf96a2f1a2467b97d84d84735c2c9af7edc (patch)
tree2f04e242c28a76c5f9d9b5fb061993148d533fbd /desktop-widgets/tab-widgets/TabDiveInformation.cpp
parentb12d0b1840ab46a2aa05d3079f36437bee688f95 (diff)
downloadsubsurface-4e7adcf96a2f1a2467b97d84d84735c2c9af7edc.tar.gz
desktop UI: remove strange sprintf calls
I'm rather upset that I never noticed this in a review. That's just not how you print numbers. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/tab-widgets/TabDiveInformation.cpp')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveInformation.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
index 8d23c2d0a..fcb5a8827 100644
--- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
@@ -161,9 +161,7 @@ void TabDiveInformation::updateProfile()
ui->atmPressVal->clear(); // If no atm pressure for dive then clear text box
} else {
ui->atmPressVal->setEnabled(true);
- QString pressStr;
- pressStr.sprintf("%d",current_dive->surface_pressure.mbar);
- ui->atmPressVal->setText(pressStr); // else display atm pressure
+ ui->atmPressVal->setText(QString::number(current_dive->surface_pressure.mbar)); // else display atm pressure
}
}
@@ -329,7 +327,7 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &dives, DiveField fi
if (field.water_temp)
ui->watertemp->setText(get_temperature_string(current_dive->watertemp, true));
if (field.atm_press)
- ui->atmPressVal->setText(ui->atmPressVal->text().sprintf("%d",current_dive->surface_pressure.mbar));
+ ui->atmPressVal->setText(QString::number(current_dive->surface_pressure.mbar));
if (field.salinity)
checkDcSalinityOverWritten();
if (current_dive->user_salinity)
@@ -423,7 +421,7 @@ void TabDiveInformation::updateTextBox(int event) // Either the text box has bee
else
altitudeVal = altitudeVal * 1000; // metric: convert altitude from meters to mm
atmpress.mbar = altitude_to_pressure((int32_t) altitudeVal); // convert altitude (mm) to pressure (mbar)
- ui->atmPressVal->setText(ui->atmPressVal->text().sprintf("%d",atmpress.mbar));
+ ui->atmPressVal->setText(QString::number(atmpress.mbar));
ui->atmPressType->setCurrentIndex(0); // reset combobox to mbar
} else { // i.e. event == COMBO_CHANGED, that is, "m" or "ft" was selected from combobox
// Show estimated altitude