aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-03 09:47:24 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-03 09:47:24 -0800
commitdfc7ee0b296dd834b794d2f5be20924d6578a96a (patch)
tree1de63c1e72f11e615a5e03596d0067d9803b46d9 /qt-ui/maintab.cpp
parent3fab68dcd3689d795248dfc5bb0c98b72b424252 (diff)
downloadsubsurface-dfc7ee0b296dd834b794d2f5be20924d6578a96a.tar.gz
Delay replot of dive so changes aren't overwritten too early
When changing tanks we triggered a replot - but that overwrote the displayed_dive with the current_dive before the remaining data from the displayed_dive was used to edit the current_dive. So now we delay this until later in the function, this way copy of paste of both tanks and weights works. Fixes #753 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index d79536427..d51c21fb0 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -663,6 +663,7 @@ void MainTab::acceptChanges()
{
int i, addedId = -1;
struct dive *d;
+ bool do_replot = false;
tabBar()->setTabIcon(0, QIcon()); // Notes
tabBar()->setTabIcon(1, QIcon()); // Equipment
ui.dateEdit->setEnabled(true);
@@ -751,7 +752,7 @@ void MainTab::acceptChanges()
);
for (int i = 0; i < MAX_CYLINDERS; i++)
cd->cylinder[i] = displayed_dive.cylinder[i];
- MainWindow::instance()->graphics()->replot();
+ do_replot = true;
}
if (weightModel->changed) {
@@ -799,6 +800,8 @@ void MainTab::acceptChanges()
emit addDiveFinished();
} else {
editMode = NONE;
+ if (do_replot)
+ MainWindow::instance()->graphics()->replot();
MainWindow::instance()->dive_list()->rememberSelection();
sort_table(&dive_table);
MainWindow::instance()->refreshDisplay();