diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-01 17:16:08 +0100 |
---|---|---|
committer | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-07 00:13:35 +0200 |
commit | fe926d35f421af4d671f53a794941e5f936bd14f (patch) | |
tree | 30b9710c1a7bb8030f726886ea426eb67f28453e /profile-widget/profilewidget2.cpp | |
parent | 24a7dbde16ce5f024f6137a2318e54815a495a94 (diff) | |
download | subsurface-fe926d35f421af4d671f53a794941e5f936bd14f.tar.gz |
undo: update profile on cylinder editing
In the profile, catch cylinder-editing signals and redraw the
profile if the currently displayed dive has changed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/profilewidget2.cpp')
-rw-r--r-- | profile-widget/profilewidget2.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index a162f8782..1b74f9d88 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -29,6 +29,7 @@ #include "core/qthelper.h" #include "core/gettextfromc.h" #include "core/imagedownloader.h" +#include "core/subsurface-qt/divelistnotifier.h" #endif #include <libdivecomputer/parser.h> @@ -169,6 +170,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), connect(DivePictureModel::instance(), &DivePictureModel::rowsInserted, this, &ProfileWidget2::plotPictures); connect(DivePictureModel::instance(), &DivePictureModel::picturesRemoved, this, &ProfileWidget2::removePictures); connect(DivePictureModel::instance(), &DivePictureModel::modelReset, this, &ProfileWidget2::plotPictures); + connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &ProfileWidget2::cylinderChanged); #endif // SUBSURFACE_MOBILE #if !defined(QT_NO_DEBUG) && defined(SHOW_PLOT_INFO_TABLE) @@ -2244,6 +2246,13 @@ void ProfileWidget2::removePictures(const QVector<QString> &fileUrls) calculatePictureYPositions(); } +void ProfileWidget2::cylinderChanged(dive *d) +{ + if (!d || d->id != displayed_dive.id) + return; // Cylinders of a differnt dive than the shown one changed. + replot(); +} + #endif void ProfileWidget2::dropEvent(QDropEvent *event) |