mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
83d10ce89a
commit
76a41f45c7
2 changed files with 9 additions and 18 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue