From a4d0f7bdb3c9a9366b9ea350eb059601233ee7ab Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 27 Feb 2014 16:42:00 -0300 Subject: New profile: Make the ruler work. (caution, fonts are BIIIG ) This patch makes the ruler work again, the problem is that the fonts are *terribly* big, I'll fix that on the next commit. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 18 +++++++++++++----- qt-ui/profile/ruleritem.cpp | 3 +++ 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'qt-ui/profile') 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 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() << 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 #include #include +#include #include @@ -171,6 +172,8 @@ void RulerItem2::setPlotInfo(plot_info info) { pInfo = info; recalculate(); + dest->recalculate(); + source->recalculate(); } void RulerItem2::setAxis(DiveCartesianAxis* time, DiveCartesianAxis* depth) -- cgit v1.2.3-70-g09d2