summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-28 13:23:23 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-28 13:35:49 -0800
commiteaec0bc84228216a79074c78347c5ad41bdec121 (patch)
treef8d93a0a1a99a456bd5319c260670cac7028559b /qt-ui
parent7f1373ea6d074c4cfbf514bc4ea6e48bf3237bcb (diff)
downloadsubsurface-eaec0bc84228216a79074c78347c5ad41bdec121.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp9
1 files changed, 5 insertions, 4 deletions
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);
}