diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-10-14 20:57:13 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-10-20 03:51:11 -0400 |
commit | fdfcbd0315d04580bf10d7b9129fa32665dfeaae (patch) | |
tree | 8a7beb3796f6d6f4289c502ef95e31cf652351d3 /desktop-widgets/divelistview.cpp | |
parent | 39c36af808047833cd6e4a9b7ab3567e41887766 (diff) | |
download | subsurface-fdfcbd0315d04580bf10d7b9129fa32665dfeaae.tar.gz |
Cleanup: use pointer-to-member-function in addAction() calls
Since requiring Qt >= 5.9.1, we can use the pointer-to-member-function
overloads of addAction (introduced in Qt 5.6). This has the advantage
of compile-time checking of the signal/slot parameters.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/divelistview.cpp')
-rw-r--r-- | desktop-widgets/divelistview.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 4983b41f4..409b22e38 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -948,18 +948,18 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event) } } if (needs_expand) - popup.addAction(tr("Expand all"), this, SLOT(expandAll())); + popup.addAction(tr("Expand all"), this, &QTreeView::expandAll); if (needs_collapse) - popup.addAction(tr("Collapse all"), this, SLOT(collapseAll())); + popup.addAction(tr("Collapse all"), this, &QTreeView::collapseAll); // verify if there`s a need for collapse others if (expanded_nodes > 1) - collapseAction = popup.addAction(tr("Collapse others"), this, SLOT(collapseAll())); + collapseAction = popup.addAction(tr("Collapse others"), this, &QTreeView::collapseAll); if (d) { - popup.addAction(tr("Remove dive(s) from trip"), this, SLOT(removeFromTrip())); - popup.addAction(tr("Create new trip above"), this, SLOT(newTripAbove())); + popup.addAction(tr("Remove dive(s) from trip"), this, &DiveListView::removeFromTrip); + popup.addAction(tr("Create new trip above"), this, &DiveListView::newTripAbove); if (!d->divetrip) { struct dive *top = d; struct dive *bottom = d; @@ -974,30 +974,30 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event) } } if (is_trip_before_after(top, (currentOrder == Qt::AscendingOrder))) - popup.addAction(tr("Add dive(s) to trip immediately above"), this, SLOT(addToTripAbove())); + popup.addAction(tr("Add dive(s) to trip immediately above"), this, &DiveListView::addToTripAbove); if (is_trip_before_after(bottom, (currentOrder == Qt::DescendingOrder))) - popup.addAction(tr("Add dive(s) to trip immediately below"), this, SLOT(addToTripBelow())); + popup.addAction(tr("Add dive(s) to trip immediately below"), this, &DiveListView::addToTripBelow); } } if (trip) { - popup.addAction(tr("Merge trip with trip above"), this, SLOT(mergeTripAbove())); - popup.addAction(tr("Merge trip with trip below"), this, SLOT(mergeTripBelow())); + popup.addAction(tr("Merge trip with trip above"), this, &DiveListView::mergeTripAbove); + popup.addAction(tr("Merge trip with trip below"), this, &DiveListView::mergeTripBelow); } } if (d) { - popup.addAction(tr("Delete dive(s)"), this, SLOT(deleteDive())); + popup.addAction(tr("Delete dive(s)"), this, &DiveListView::deleteDive); #if 0 - popup.addAction(tr("Mark dive(s) invalid", this, SLOT(markDiveInvalid()))); + popup.addAction(tr("Mark dive(s) invalid", this, &DiveListView::markDiveInvalid); #endif } if (amount_selected > 1 && consecutive_selected()) - popup.addAction(tr("Merge selected dives"), this, SLOT(mergeDives())); + popup.addAction(tr("Merge selected dives"), this, &DiveListView::mergeDives); if (amount_selected >= 1) { - popup.addAction(tr("Renumber dive(s)"), this, SLOT(renumberDives())); - popup.addAction(tr("Shift dive times"), this, SLOT(shiftTimes())); - popup.addAction(tr("Split selected dives"), this, SLOT(splitDives())); - popup.addAction(tr("Load media from file(s)"), this, SLOT(loadImages())); - popup.addAction(tr("Load media from web"), this, SLOT(loadWebImages())); + popup.addAction(tr("Renumber dive(s)"), this, &DiveListView::renumberDives); + popup.addAction(tr("Shift dive times"), this, &DiveListView::shiftTimes); + popup.addAction(tr("Split selected dives"), this, &DiveListView::splitDives); + popup.addAction(tr("Load media from file(s)"), this, &DiveListView::loadImages); + popup.addAction(tr("Load media from web"), this, &DiveListView::loadWebImages); } // "collapse all" really closes all trips, |