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>
This commit is contained in:
Dirk Hohndel 2014-11-03 09:47:24 -08:00
parent 3fab68dcd3
commit dfc7ee0b29

View file

@ -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();