From f193c2ef08d0edb1f40b6011a205eb8603c6019b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 25 Oct 2020 14:42:40 -0700 Subject: cleanup: fix deprecated QVector constructor Annoyingly, the replacement has only been available since Qt 5.14. To make the code less messy, implement our own stdToQt conversion helper. Suggested-by: Berthold Stoeger Signed-off-by: Dirk Hohndel --- desktop-widgets/divelistview.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'desktop-widgets/divelistview.cpp') diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 92638a336..f98b298f4 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -17,6 +17,7 @@ #include #include #include "commands/command.h" +#include "commands/command_base.h" #include "core/errorhelper.h" #include "core/qthelper.h" #include "core/trip.h" @@ -645,7 +646,7 @@ void DiveListView::addDivesToTrip() std::vector dives = getDiveSelection(); if (!t || dives.empty()) return; - Command::addDivesToTrip(QVector::fromStdVector(dives), t); + Command::addDivesToTrip(stdToQt(dives), t); } void DiveListView::renumberDives() @@ -734,8 +735,8 @@ void DiveListView::addToTrip(int delta) if (!trip || !d) // no dive, no trip? get me out of here return; - - Command::addDivesToTrip(QVector::fromStdVector(getDiveSelection()), trip); + std::vector dives = getDiveSelection(); + Command::addDivesToTrip(stdToQt(dives), trip); } void DiveListView::markDiveInvalid() @@ -753,8 +754,7 @@ void DiveListView::deleteDive() struct dive *d = contextMenuIndex.data(DiveTripModelBase::DIVE_ROLE).value(); if (!d) return; - - Command::deleteDive(QVector::fromStdVector(getDiveSelection())); + Command::deleteDive(stdToQt(getDiveSelection())); } void DiveListView::contextMenuEvent(QContextMenuEvent *event) -- cgit v1.2.3-70-g09d2