diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-02 22:23:40 +0100 |
---|---|---|
committer | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-07 00:13:35 +0200 |
commit | 76a41f45c7e69375f13b3942523e0f8753b1f9b7 (patch) | |
tree | 24c31356dc3782eec48e4eb9003ed045a8c006f1 /profile-widget/profilewidget2.h | |
parent | 83d10ce89a1544044ea907e39f498183adb554f2 (diff) | |
download | subsurface-76a41f45c7e69375f13b3942523e0f8753b1f9b7.tar.gz |
cleanup: use lambdas to transport DiveEventItem to actions
The removeEvent(), hideEvents() and editName() actions need
the DiveEventItem they are applied to. This was transported
via QAction's user-data, which means casting to void and
back.
By using lambdas instead, this can be made perfectly type-safe:
First we are 100% sure that we have a DiveEventItem because
we check the result of a dynamic_cast<>. Then we can pass
it to the even using its proper type.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/profilewidget2.h')
-rw-r--r-- | profile-widget/profilewidget2.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 342032567..bc049781d 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -115,10 +115,7 @@ slots: // Necessary to call from QAction's signals. void removePictures(const QVector<QString> &fileUrls); void setPlanState(); void setAddState(); - void hideEvents(); void unhideEvents(); - void removeEvent(); - void editName(); void makeFirstDC(); void deleteCurrentDC(); void splitCurrentDC(); @@ -175,6 +172,9 @@ private: void addBookmark(int seconds); void splitDive(int seconds); void addSetpointChange(int seconds); + void removeEvent(DiveEventItem *item); + void hideEvents(DiveEventItem *item); + void editName(DiveEventItem *item); private: DivePlotDataModel *dataModel; int zoomLevel; |