summaryrefslogtreecommitdiffstats
path: root/profile-widget/profilewidget2.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-02 22:23:40 +0100
committerGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-07 00:13:35 +0200
commit76a41f45c7e69375f13b3942523e0f8753b1f9b7 (patch)
tree24c31356dc3782eec48e4eb9003ed045a8c006f1 /profile-widget/profilewidget2.h
parent83d10ce89a1544044ea907e39f498183adb554f2 (diff)
downloadsubsurface-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.h6
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;