aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-02-23 20:11:44 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 13:53:23 -0700
commit457be51ff66fb7c3396863a27f4d93de1877e3b2 (patch)
tree54258acf689b8581a3b6b18ec2724e01eea8c438
parenta3d8191896c86fd05b96d38371f89f6d6f621789 (diff)
downloadsubsurface-457be51ff66fb7c3396863a27f4d93de1877e3b2.tar.gz
profile: remove redundant replot() calls in key events
When moving "dive handlers" with the cursor keys, the profile was replot twice: - First the recalculation of the planner model was suspended. - The "stop" was moved. - This led to a replot by a signal from the planner model. However, the old profile was shown, since the recalculation was suspended. - The recalculation was reenabled. - The profile war replot, resulting now in the correct profile. A classical case of bit rot. Instead, don't suspend calculation in the first place. This shows the correct profile on the first replot and the second replot can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--profile-widget/profilewidget2.cpp13
1 files changed, 0 insertions, 13 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index f1dfc263f..d5cae62a4 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1813,8 +1813,6 @@ void ProfileWidget2::keyDownAction()
if ((currentState != ADD && currentState != PLAN) || !plannerModel)
return;
- bool oldRecalc = plannerModel->setRecalc(false);
-
Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
int row = handleIndex(handler);
@@ -1824,8 +1822,6 @@ void ProfileWidget2::keyDownAction()
plannerModel->editStop(row, dp);
}
}
- plannerModel->setRecalc(oldRecalc);
- replot();
}
void ProfileWidget2::keyUpAction()
@@ -1833,7 +1829,6 @@ void ProfileWidget2::keyUpAction()
if ((currentState != ADD && currentState != PLAN) || !plannerModel)
return;
- bool oldRecalc = plannerModel->setRecalc(false);
Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
int row = handleIndex(handler);
@@ -1846,8 +1841,6 @@ void ProfileWidget2::keyUpAction()
plannerModel->editStop(row, dp);
}
}
- plannerModel->setRecalc(oldRecalc);
- replot();
}
void ProfileWidget2::keyLeftAction()
@@ -1855,7 +1848,6 @@ void ProfileWidget2::keyLeftAction()
if ((currentState != ADD && currentState != PLAN) || !plannerModel)
return;
- bool oldRecalc = plannerModel->setRecalc(false);
Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
int row = handleIndex(handler);
@@ -1868,8 +1860,6 @@ void ProfileWidget2::keyLeftAction()
plannerModel->editStop(row, dp);
}
}
- plannerModel->setRecalc(oldRecalc);
- replot();
}
void ProfileWidget2::keyRightAction()
@@ -1877,7 +1867,6 @@ void ProfileWidget2::keyRightAction()
if ((currentState != ADD && currentState != PLAN) || !plannerModel)
return;
- bool oldRecalc = plannerModel->setRecalc(false);
Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
int row = handleIndex(handler);
@@ -1887,8 +1876,6 @@ void ProfileWidget2::keyRightAction()
plannerModel->editStop(row, dp);
}
}
- plannerModel->setRecalc(oldRecalc);
- replot();
}
void ProfileWidget2::keyDeleteAction()