diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-02-27 16:42:00 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-27 12:03:59 -0800 |
commit | a4d0f7bdb3c9a9366b9ea350eb059601233ee7ab (patch) | |
tree | 5202a9b0a81bea8023c6a1b9bbd839f754d6ae11 /qt-ui/profile | |
parent | 0a24e134696577dfc967f7e2ad1b4f0ab87740d6 (diff) | |
download | subsurface-a4d0f7bdb3c9a9366b9ea350eb059601233ee7ab.tar.gz |
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 <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-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) |