mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
08689b2f89
commit
223d99f79f
1 changed files with 11 additions and 9 deletions
|
|
@ -475,9 +475,10 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
|
||||||
|
|
||||||
void ProfileWidget2::settingsChanged()
|
void ProfileWidget2::settingsChanged()
|
||||||
{
|
{
|
||||||
QSettings s;
|
// if we are showing calculated ceilings then we have to replot()
|
||||||
s.beginGroup("TecDetails");
|
// because the GF could have changed; otherwise we try to avoid replot()
|
||||||
if (prefs.pp_graphs.phe || prefs.pp_graphs.po2 || prefs.pp_graphs.pn2) {
|
bool needReplot = prefs.calcceiling;
|
||||||
|
if (PP_GRAPHS_ENABLED) {
|
||||||
profileYAxis->animateChangeLine(itemPos.depth.shrinked);
|
profileYAxis->animateChangeLine(itemPos.depth.shrinked);
|
||||||
temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
|
temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
|
||||||
cylinderPressureAxis->animateChangeLine(itemPos.cylinder.shrinked);
|
cylinderPressureAxis->animateChangeLine(itemPos.cylinder.shrinked);
|
||||||
|
|
@ -488,20 +489,21 @@ void ProfileWidget2::settingsChanged()
|
||||||
}
|
}
|
||||||
if (prefs.zoomed_plot != isPlotZoomed) {
|
if (prefs.zoomed_plot != isPlotZoomed) {
|
||||||
isPlotZoomed = prefs.zoomed_plot;
|
isPlotZoomed = prefs.zoomed_plot;
|
||||||
replot();
|
needReplot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentState == PROFILE) {
|
if (currentState == PROFILE) {
|
||||||
bool rulerVisible = s.value("rulergraph", false).toBool();
|
rulerItem->setVisible(prefs.rulergraph);
|
||||||
rulerItem->setVisible(rulerVisible);
|
rulerItem->destNode()->setVisible(prefs.rulergraph);
|
||||||
rulerItem->destNode()->setVisible(rulerVisible);
|
rulerItem->sourceNode()->setVisible(prefs.rulergraph);
|
||||||
rulerItem->sourceNode()->setVisible(rulerVisible);
|
needReplot = true;
|
||||||
replot();
|
|
||||||
} else {
|
} else {
|
||||||
rulerItem->setVisible(false);
|
rulerItem->setVisible(false);
|
||||||
rulerItem->destNode()->setVisible(false);
|
rulerItem->destNode()->setVisible(false);
|
||||||
rulerItem->sourceNode()->setVisible(false);
|
rulerItem->sourceNode()->setVisible(false);
|
||||||
}
|
}
|
||||||
|
if (needReplot)
|
||||||
|
replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::resizeEvent(QResizeEvent *event)
|
void ProfileWidget2::resizeEvent(QResizeEvent *event)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue