aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp12
-rw-r--r--qt-ui/profile/diveprofileitem.h4
-rw-r--r--qt-ui/profile/profilewidget2.cpp1
3 files changed, 17 insertions, 0 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index f8a37aeba..0b1d32a4e 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -534,6 +534,18 @@ void MeanDepthLine::setMeanDepth(int value)
{
leftText->setText(get_depth_string(value, false, false));
rightText->setText(get_depth_string(value, false, false));
+ meanDepth = value;
+}
+
+void MeanDepthLine::setAxis(DiveCartesianAxis* a)
+{
+ connect(a, SIGNAL(sizeChanged()), this, SLOT(axisLineChanged()));
+}
+
+void MeanDepthLine::axisLineChanged()
+{
+ DiveCartesianAxis *axis = qobject_cast<DiveCartesianAxis*>(sender());
+ animateMoveTo(x(),axis->posAtValue(meanDepth));
}
void PartialPressureGasItem::modelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h
index 640b0d4a6..b51958104 100644
--- a/qt-ui/profile/diveprofileitem.h
+++ b/qt-ui/profile/diveprofileitem.h
@@ -135,10 +135,14 @@ public:
MeanDepthLine();
void setMeanDepth(int value);
void setLine(qreal x1, qreal y1, qreal x2, qreal y2);
+ void setAxis(DiveCartesianAxis *a);
+public slots:
+ void axisLineChanged();
private:
int meanDepth;
DiveTextItem *leftText;
DiveTextItem *rightText;
+ DiveCartesianAxis *axis;
};
class PartialPressureGasItem : public AbstractProfilePolygonItem{
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index ccbc4f6a1..cfe8e7f82 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -145,6 +145,7 @@ void ProfileWidget2::setupItemOnScene()
meanDepth->setX(3);
meanDepth->setPen(QPen(QBrush(Qt::red), 0, Qt::SolidLine));
meanDepth->setZValue(1);
+ meanDepth->setAxis(profileYAxis);
cartesianPlane->setBottomAxis(timeAxis);
cartesianPlane->setLeftAxis(profileYAxis);