diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-05-05 15:58:25 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-05 15:58:25 -0700 |
commit | 223d99f79f3b80bc45a6abc6d510f9250a181363 (patch) | |
tree | 1f64af13fd16dc9c4a6000d82f72e106226e9846 /qt-ui/profile | |
parent | 08689b2f89bc62ad55ab88562d4394d872511075 (diff) | |
download | subsurface-223d99f79f3b80bc45a6abc6d510f9250a181363.tar.gz |
Change the profile redraw logic after preferences were changed
I we are showing a calculated ceiling, then we have to replot the profile
after a preferences change as the gradient factors could have changed
which might change a calculated ceiling.
Also use the rulergraph preference instead of checking the settings
directly.
Fixes #511
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 0f397d2ff..f2fddb5e4 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -475,9 +475,10 @@ void ProfileWidget2::plotDives(QList<dive *> dives) void ProfileWidget2::settingsChanged() { - QSettings s; - s.beginGroup("TecDetails"); - if (prefs.pp_graphs.phe || prefs.pp_graphs.po2 || prefs.pp_graphs.pn2) { + // if we are showing calculated ceilings then we have to replot() + // because the GF could have changed; otherwise we try to avoid replot() + bool needReplot = prefs.calcceiling; + if (PP_GRAPHS_ENABLED) { profileYAxis->animateChangeLine(itemPos.depth.shrinked); temperatureAxis->animateChangeLine(itemPos.temperature.shrinked); cylinderPressureAxis->animateChangeLine(itemPos.cylinder.shrinked); @@ -488,20 +489,21 @@ void ProfileWidget2::settingsChanged() } if (prefs.zoomed_plot != isPlotZoomed) { isPlotZoomed = prefs.zoomed_plot; - replot(); + needReplot = true; } if (currentState == PROFILE) { - bool rulerVisible = s.value("rulergraph", false).toBool(); - rulerItem->setVisible(rulerVisible); - rulerItem->destNode()->setVisible(rulerVisible); - rulerItem->sourceNode()->setVisible(rulerVisible); - replot(); + rulerItem->setVisible(prefs.rulergraph); + rulerItem->destNode()->setVisible(prefs.rulergraph); + rulerItem->sourceNode()->setVisible(prefs.rulergraph); + needReplot = true; } else { rulerItem->setVisible(false); rulerItem->destNode()->setVisible(false); rulerItem->sourceNode()->setVisible(false); } + if (needReplot) + replot(); } void ProfileWidget2::resizeEvent(QResizeEvent *event) |