summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/maintab.cpp6
-rw-r--r--qt-ui/maintab.h8
2 files changed, 12 insertions, 2 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index d9249046f..a52409c87 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -329,8 +329,10 @@ void MainTab::updateDiveInfo(int dive)
ui->timeLimits->setAverage(get_time_string(seconds, 0));
ui->timeLimits->setMaximum(get_time_string(stats_selection.longest_time.seconds, 0));
ui->timeLimits->setMinimum(get_time_string(stats_selection.shortest_time.seconds, 0));
- cylindersModel->setDive(d);
- weightModel->setDive(d);
+
+ multiEditEquipmentPlaceholder = *d;
+ cylindersModel->setDive(&multiEditEquipmentPlaceholder);
+ weightModel->setDive(&multiEditEquipmentPlaceholder);
} else {
/* clear the fields */
ui->rating->setCurrentStars(0);
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 1970bad1f..023a4de0c 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -81,6 +81,14 @@ private:
WeightModel *weightModel;
CylindersModel *cylindersModel;
QMap<dive*, NotesBackup> notesBackup;
+
+ /* since the multi-edition of the equipment is fairly more
+ * complex than a single item, because it involves a Qt
+ * Model to edit things, we are copying the first selected
+ * dive to this structure, making all editions there,
+ * then applying the changes on the other dives.*/
+ struct dive multiEditEquipmentPlaceholder;
+
enum { NONE, DIVE, TRIP, ADD } editMode;
Completers completers;
void enableEdition();