diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-05-05 11:42:01 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-05-06 11:44:22 -0700 |
commit | 30133946e0354339078dacb18869ae09747f2caf (patch) | |
tree | 01aae56150571576404a38bb8727e9a44be9516f /qt-models/divetripmodel.cpp | |
parent | beef8096f7d3f580804a30a55364b057897dfcb3 (diff) | |
download | subsurface-30133946e0354339078dacb18869ae09747f2caf.tar.gz |
models: emit dive changed signal when cylinders edited
To display changed SAC values it is necessary that the models
emit changed signals when cylinders are edited. An alternative
might be that the undo commands emit dive-changed signals themselves.
Fixes #2814.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r-- | qt-models/divetripmodel.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 784013bce..0af987191 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -716,6 +716,9 @@ DiveTripModelTree::DiveTripModelTree(QObject *parent) : DiveTripModelBase(parent connect(&diveListNotifier, &DiveListNotifier::divesSelected, this, &DiveTripModelTree::divesSelected); connect(&diveListNotifier, &DiveListNotifier::tripChanged, this, &DiveTripModelTree::tripChanged); connect(&diveListNotifier, &DiveListNotifier::filterReset, this, &DiveTripModelTree::filterReset); + connect(&diveListNotifier, &DiveListNotifier::cylinderAdded, this, &DiveTripModelTree::cylinderChanged); + connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &DiveTripModelTree::cylinderChanged); + connect(&diveListNotifier, &DiveListNotifier::cylinderRemoved, this, &DiveTripModelTree::cylinderChanged); populate(); } @@ -1253,6 +1256,11 @@ void DiveTripModelTree::divesChanged(const QVector<dive *> &dives) { divesChangedTrip(trip, divesInTrip); }); } +void DiveTripModelTree::cylinderChanged(dive *d) +{ + divesChanged(QVector<dive *> { d }); +} + void DiveTripModelTree::divesChangedTrip(dive_trip *trip, const QVector<dive *> &divesIn) { QVector<dive *> dives = divesIn; @@ -1469,6 +1477,9 @@ DiveTripModelList::DiveTripModelList(QObject *parent) : DiveTripModelBase(parent connect(&diveListNotifier, &DiveListNotifier::divesTimeChanged, this, &DiveTripModelList::divesTimeChanged); connect(&diveListNotifier, &DiveListNotifier::divesSelected, this, &DiveTripModelList::divesSelected); connect(&diveListNotifier, &DiveListNotifier::filterReset, this, &DiveTripModelList::filterReset); + connect(&diveListNotifier, &DiveListNotifier::cylinderAdded, this, &DiveTripModelList::cylinderChanged); + connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &DiveTripModelList::cylinderChanged); + connect(&diveListNotifier, &DiveListNotifier::cylinderRemoved, this, &DiveTripModelList::cylinderChanged); populate(); } @@ -1622,6 +1633,11 @@ void DiveTripModelList::divesChanged(const QVector<dive *> &divesIn) initSelection(); } +void DiveTripModelList::cylinderChanged(dive *d) +{ + divesChanged(QVector<dive *> { d }); +} + void DiveTripModelList::divesTimeChanged(timestamp_t delta, const QVector<dive *> &divesIn) { QVector<dive *> dives = visibleDives(divesIn); |