diff options
Diffstat (limited to 'qt-ui/profile/diveprofileitem.cpp')
-rw-r--r-- | qt-ui/profile/diveprofileitem.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 9fda21485..5ddef1e90 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -7,6 +7,7 @@ #include "dive.h" #include "profilegraphics.h" #include "preferences.h" +#include "helpers.h" #include <QPen> #include <QPainter> @@ -384,7 +385,6 @@ void DiveCalculatedCeiling::paint(QPainter* painter, const QStyleOptionGraphicsI QGraphicsPolygonItem::paint(painter, option, widget); } - void DiveReportedCeiling::modelDataChanged() { if (!hAxis || !vAxis || !dataModel || hDataColumn == -1 || vDataColumn == -1) @@ -425,3 +425,28 @@ void DiveReportedCeiling::paint(QPainter* painter, const QStyleOptionGraphicsIte { QGraphicsPolygonItem::paint(painter, option, widget); } + +MeanDepthLine::MeanDepthLine() +{ + leftText = new DiveTextItem(this); + leftText->setAlignment(Qt::AlignRight | Qt::AlignBottom); + leftText->setBrush(getColor(MEAN_DEPTH)); + rightText = new DiveTextItem(this); + rightText->setAlignment(Qt::AlignLeft | Qt::AlignBottom); + rightText->setBrush(getColor(MEAN_DEPTH)); + leftText->setPos(0, 0); + rightText->setPos(line().length(), 0); +} + +void MeanDepthLine::setLine(qreal x1, qreal y1, qreal x2, qreal y2) +{ + QGraphicsLineItem::setLine(x1, y1, x2, y2); + leftText->setPos(x1, 0); + rightText->setPos(x2, 0); +} + +void MeanDepthLine::setMeanDepth(int value) +{ + leftText->setText(get_depth_string(value, false, false)); + rightText->setText(get_depth_string(value, false, false)); +} |