From 609fdda98d3a5e7f996c2c5c0be591a340ca8815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 5 Jun 2020 12:55:24 -0300 Subject: [PATCH] SurveyComplexItem: Remove deprecated intersect function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- src/MissionManager/SurveyComplexItem.cc | 29 ++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/MissionManager/SurveyComplexItem.cc b/src/MissionManager/SurveyComplexItem.cc index 1edd4200b..f1c6461ae 100644 --- a/src/MissionManager/SurveyComplexItem.cc +++ b/src/MissionManager/SurveyComplexItem.cc @@ -520,12 +520,20 @@ void SurveyComplexItem::_intersectLinesWithRect(const QList& lineList, c QLineF intersectLine; const QLineF& line = lineList[i]; + auto isLineBoundedIntersect = [&line, &intersectPoint](const QLineF& linePosition) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + return line.intersect(linePosition, &intersectPoint) == QLineF::BoundedIntersection; +#else + return line.intersects(linePosition, &intersectPoint) == QLineF::BoundedIntersection; +#endif + }; + int foundCount = 0; - if (line.intersect(topLine, &intersectPoint) == QLineF::BoundedIntersection) { + if (isLineBoundedIntersect(topLine)) { intersectLine.setP1(intersectPoint); foundCount++; } - if (line.intersect(rightLine, &intersectPoint) == QLineF::BoundedIntersection) { + if (isLineBoundedIntersect(rightLine)) { if (foundCount == 0) { intersectLine.setP1(intersectPoint); } else { @@ -536,7 +544,7 @@ void SurveyComplexItem::_intersectLinesWithRect(const QList& lineList, c } foundCount++; } - if (line.intersect(bottomLine, &intersectPoint) == QLineF::BoundedIntersection) { + if (isLineBoundedIntersect(bottomLine)) { if (foundCount == 0) { intersectLine.setP1(intersectPoint); } else { @@ -547,7 +555,7 @@ void SurveyComplexItem::_intersectLinesWithRect(const QList& lineList, c } foundCount++; } - if (line.intersect(leftLine, &intersectPoint) == QLineF::BoundedIntersection) { + if (isLineBoundedIntersect(leftLine)) { if (foundCount == 0) { intersectLine.setP1(intersectPoint); } else { @@ -577,7 +585,13 @@ void SurveyComplexItem::_intersectLinesWithPolygon(const QList& lineList for (int j=0; j