From eaec0bc84228216a79074c78347c5ad41bdec121 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 28 Jan 2015 13:23:23 -0800 Subject: Small changes to the mean depth text Add a tiny bit of white space to the left and display the unit as well. Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveprofileitem.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'qt-ui/profile') diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 5b8663a17..81e91c771 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -609,19 +609,20 @@ void DiveMeanDepthItem::settingsChanged() setVisible(prefs.show_average_depth); } -void DiveMeanDepthItem::createTextItem(){ +void DiveMeanDepthItem::createTextItem() { plot_data *entry = dataModel->data().entry; int sec = entry[dataModel->rowCount()-1].sec; qDeleteAll(texts); texts.clear(); int decimals; - double d = get_depth_units(lastRunningSum, &decimals, NULL); + const char *unitText; + double d = get_depth_units(lastRunningSum, &decimals, &unitText); DiveTextItem *text = new DiveTextItem(this); text->setAlignment(Qt::AlignRight | Qt::AlignTop); text->setBrush(getColor(TEMP_TEXT)); - text->setPos(QPointF(hAxis->posAtValue(sec), vAxis->posAtValue(lastRunningSum))); + text->setPos(QPointF(hAxis->posAtValue(sec) + 1, vAxis->posAtValue(lastRunningSum))); text->setScale(0.8); // need to call this BEFORE setText() - text->setText(QString("%1").arg(d, 0, 'f', 1)); + text->setText(QString("%1%2").arg(d, 0, 'f', 1).arg(*unitText)); texts.append(text); } -- cgit v1.2.3-70-g09d2