mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
7f1373ea6d
commit
eaec0bc842
1 changed files with 5 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue