diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 18 | ||||
-rw-r--r-- | qt-ui/profile/ruleritem.cpp | 3 |
2 files changed, 16 insertions, 5 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index ca176a3d4..ee9e80be6 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -172,6 +172,8 @@ void ProfileWidget2::setupItemOnScene() diveComputerText->setAlignment(Qt::AlignRight | Qt::AlignTop); diveComputerText->setBrush(getColor(TIME_TEXT)); + rulerItem->setAxis(timeAxis, profileYAxis); + setupItem(reportedCeiling, timeAxis, profileYAxis, dataModel, DivePlotDataModel::CEILING, DivePlotDataModel::TIME, 1); setupItem(diveCeiling, timeAxis, profileYAxis, dataModel, DivePlotDataModel::CEILING, DivePlotDataModel::TIME, 1); for(int i = 0; i < 16; i++){ @@ -364,7 +366,7 @@ void ProfileWidget2::plotDives(QList<dive*> dives) heartBeatAxis->setVisible(false); } timeAxis->setMaximum(maxtime); - + rulerItem->setPlotInfo(pInfo); int i, incr; static int increments[8] = { 10, 20, 30, 60, 5*60, 10*60, 15*60, 30*60 }; /* Time markers: at most every 10 seconds, but no more than 12 markers. @@ -434,10 +436,16 @@ void ProfileWidget2::settingsChanged() plotDives(QList<dive*>() << getDiveById(diveId)); } - bool rulerVisible = s.value("rulergraph", false).toBool(); - rulerItem->setVisible(rulerVisible); - rulerItem->destNode()->setVisible(rulerVisible ); - rulerItem->sourceNode()->setVisible(rulerVisible ); + if(currentState == PROFILE){ + bool rulerVisible = s.value("rulergraph", false).toBool(); + rulerItem->setVisible(rulerVisible); + rulerItem->destNode()->setVisible(rulerVisible ); + rulerItem->sourceNode()->setVisible(rulerVisible ); + }else{ + rulerItem->setVisible(false); + rulerItem->destNode()->setVisible(false); + rulerItem->sourceNode()->setVisible(false); + } } void ProfileWidget2::resizeEvent(QResizeEvent* event) diff --git a/qt-ui/profile/ruleritem.cpp b/qt-ui/profile/ruleritem.cpp index 3c53d3d43..d2b06f72d 100644 --- a/qt-ui/profile/ruleritem.cpp +++ b/qt-ui/profile/ruleritem.cpp @@ -3,6 +3,7 @@ #include <QFontMetrics> #include <QPainter> #include <QGraphicsScene> +#include <QDebug> #include <stdint.h> @@ -171,6 +172,8 @@ void RulerItem2::setPlotInfo(plot_info info) { pInfo = info; recalculate(); + dest->recalculate(); + source->recalculate(); } void RulerItem2::setAxis(DiveCartesianAxis* time, DiveCartesianAxis* depth) |