diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-01-18 14:38:21 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-18 14:38:21 -0800 |
commit | 3bbc4ecd0bce0995d0d616b068a9e3adc21b3da3 (patch) | |
tree | db33eb6420912785c4105f6b8f9acb0d673d21d4 /qt-ui/profile/profilewidget2.cpp | |
parent | 733108b47385c68e163baebc10ff29c145d3685f (diff) | |
download | subsurface-3bbc4ecd0bce0995d0d616b068a9e3adc21b3da3.tar.gz |
Add mean depth to new profile
With massive hand-holding by Tomaz.
Writing for the new profile code is slightly different. You don't draw
anything, you just tell the widget where things are supposed to end up and
how they are supposed to look. Really nice.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 09f41bdc9..bb14cf28b 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -36,7 +36,8 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : cylinderPressureAxis(new DiveCartesianAxis()), temperatureItem(NULL), gasPressureItem(NULL), - cartesianPlane(new DiveCartesianPlane()) + cartesianPlane(new DiveCartesianPlane()), + meanDepth(new DiveLineItem()) { setScene(new QGraphicsScene()); scene()->setSceneRect(0, 0, 100, 100); @@ -83,6 +84,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : depthController->setRect(0, 0, 10, 5); timeController->setRect(0, 0, 10, 5); timeController->setX(sceneRect().width() - timeController->boundingRect().width()); // Position it on the right spot. + meanDepth->setLine(0,0,96,0); + meanDepth->setX(3); + meanDepth->setPen(QPen(QBrush(Qt::red), 0, Qt::SolidLine)); cartesianPlane->setBottomAxis(timeAxis); cartesianPlane->setLeftAxis(profileYAxis); @@ -90,7 +94,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : // insert in the same way it's declared on the Enum. This is needed so we don't use an map. QList<QGraphicsItem*> stateItems; stateItems << background << profileYAxis << gasYAxis << - timeAxis << depthController << timeController << temperatureAxis << cylinderPressureAxis; + timeAxis << depthController << timeController << + temperatureAxis << cylinderPressureAxis << + meanDepth; Q_FOREACH(QGraphicsItem *item, stateItems) { scene()->addItem(item); } @@ -294,7 +300,7 @@ void ProfileWidget2::plotDives(QList<dive*> dives) cylinderPressureAxis->setMinimum(pInfo.minpressure); cylinderPressureAxis->setMaximum(pInfo.maxpressure); cylinderPressureAxis->updateTicks(); - + meanDepth->animateMoveTo(3, profileYAxis->posAtValue(pInfo.meandepth)); dataModel->setDive(current_dive, pInfo); if (diveProfileItem) { |