From 827d6aa934bf3fcde377f5e65e8c9d0bad93305a Mon Sep 17 00:00:00 2001 From: Martin Reboredo Date: Mon, 29 Nov 2021 18:11:11 -0300 Subject: [PATCH] Renovate usages of QLineF intersections --- Engine/RotoContext.cpp | 4 ++++ Gui/Edge.cpp | 20 ++++++++++++++++++++ Gui/NodeGui.cpp | 8 ++++++++ Gui/ViewerGLPrivate.cpp | 16 ++++++++++++++++ 4 files changed, 48 insertions(+) diff --git a/Engine/RotoContext.cpp b/Engine/RotoContext.cpp index 17fe0f066d..0b028c2b50 100644 --- a/Engine/RotoContext.cpp +++ b/Engine/RotoContext.cpp @@ -4476,7 +4476,11 @@ RotoContextPrivate::bezulate(double time, QPointF intersectionPoint; for (; cur != polygon.end(); ++cur, ++last_pt) { QLineF polygonSegment( QPointF(last_pt->x, last_pt->y), QPointF(cur->x, cur->y) ); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + if (line.intersects(polygonSegment, &intersectionPoint) == QLineF::BoundedIntersection) { +#else if (line.intersect(polygonSegment, &intersectionPoint) == QLineF::BoundedIntersection) { +#endif intersections.insert(intersectionPoint); } if (intersections.size() > 2) { diff --git a/Gui/Edge.cpp b/Gui/Edge.cpp index 00320c5b4c..463b12fb2c 100644 --- a/Gui/Edge.cpp +++ b/Gui/Edge.cpp @@ -487,7 +487,11 @@ Edge::initLine() if (dest) { for (int i = 0; i < 4; ++i) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType type = dstEdges[i].intersects(line(), &dstIntersection); +#else QLineF::IntersectType type = dstEdges[i].intersect(line(), &dstIntersection); +#endif if (type == QLineF::BoundedIntersection) { setLine( QLineF( dstIntersection, line().p2() ) ); foundDstIntersection = true; @@ -502,7 +506,11 @@ Edge::initLine() if (foundDstIntersection) { ///Find the intersection with the source bbox for (int i = 0; i < 4; ++i) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType type = srcEdges[i].intersects(line(), &srcInteresect); +#else QLineF::IntersectType type = srcEdges[i].intersect(line(), &srcInteresect); +#endif if (type == QLineF::BoundedIntersection) { foundSrcIntersection = true; break; @@ -544,7 +552,11 @@ Edge::initLine() QPointF intersection; bool foundIntersection = false; for (int i = 0; i < 4; ++i) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType type = dstEdges[i].intersects(line(), &intersection); +#else QLineF::IntersectType type = dstEdges[i].intersect(line(), &intersection); +#endif if (type == QLineF::BoundedIntersection) { setLine( QLineF( intersection, line().p2() ) ); foundIntersection = true; @@ -884,7 +896,11 @@ LinkArrow::refreshPosition() QPointF slaveIntersect; bool foundIntersection = false; for (int i = 0; i < 4; ++i) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType type = slaveEdges[i].intersects(line(), &slaveIntersect); +#else QLineF::IntersectType type = slaveEdges[i].intersect(line(), &slaveIntersect); +#endif if (type == QLineF::BoundedIntersection) { foundIntersection = true; break; @@ -900,7 +916,11 @@ LinkArrow::refreshPosition() foundIntersection = false; for (int i = 0; i < 4; ++i) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType type = masterEdges[i].intersects(line(), &masterIntersect); +#else QLineF::IntersectType type = masterEdges[i].intersect(line(), &masterIntersect); +#endif if (type == QLineF::BoundedIntersection) { foundIntersection = true; break; diff --git a/Gui/NodeGui.cpp b/Gui/NodeGui.cpp index 6c988ea9d6..56b6ed0027 100644 --- a/Gui/NodeGui.cpp +++ b/Gui/NodeGui.cpp @@ -1868,7 +1868,11 @@ NodeGui::hasEdgeNearbyRect(const QRectF & rect) edgeLine.setP1( (*it)->mapToScene( edgeLine.p1() ) ); edgeLine.setP2( (*it)->mapToScene( edgeLine.p2() ) ); for (int j = 0; j < 4; ++j) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + if (edgeLine.intersects(rectEdges[j], &intersection) == QLineF::BoundedIntersection) { +#else if (edgeLine.intersect(rectEdges[j], &intersection) == QLineF::BoundedIntersection) { +#endif if (!closest) { closest = *it; closestSquareDist = ( intersection.x() - middleRect.x() ) * ( intersection.x() - middleRect.x() ) @@ -1895,7 +1899,11 @@ NodeGui::hasEdgeNearbyRect(const QRectF & rect) edgeLine.setP1( (_outputEdge)->mapToScene( edgeLine.p1() ) ); edgeLine.setP2( (_outputEdge)->mapToScene( edgeLine.p2() ) ); for (int j = 0; j < 4; ++j) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + if (edgeLine.intersects(rectEdges[j], &intersection) == QLineF::BoundedIntersection) { +#else if (edgeLine.intersect(rectEdges[j], &intersection) == QLineF::BoundedIntersection) { +#endif return _outputEdge; } } diff --git a/Gui/ViewerGLPrivate.cpp b/Gui/ViewerGLPrivate.cpp index b98c8ae00a..c566eaca2d 100644 --- a/Gui/ViewerGLPrivate.cpp +++ b/Gui/ViewerGLPrivate.cpp @@ -564,7 +564,11 @@ ViewerGL::Implementation::getWipePolygon(const RectD & texRectClipped, if (crossProd11 * crossProd21 < 0) { QLineF e(texRectClipped.x1, texRectClipped.y1, texRectClipped.x2, texRectClipped.y1); QPointF p; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType t = inter.intersects(e, &p); +#else QLineF::IntersectType t = inter.intersect(e, &p); +#endif if (t == QLineF::BoundedIntersection) { *polygonPoints << p; } @@ -575,7 +579,11 @@ ViewerGL::Implementation::getWipePolygon(const RectD & texRectClipped, if (crossProd21 * crossProd22 < 0) { QLineF e(texRectClipped.x2, texRectClipped.y1, texRectClipped.x2, texRectClipped.y2); QPointF p; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType t = inter.intersects(e, &p); +#else QLineF::IntersectType t = inter.intersect(e, &p); +#endif if (t == QLineF::BoundedIntersection) { *polygonPoints << p; } @@ -586,7 +594,11 @@ ViewerGL::Implementation::getWipePolygon(const RectD & texRectClipped, if (crossProd22 * crossProd12 < 0) { QLineF e(texRectClipped.x2, texRectClipped.y2, texRectClipped.x1, texRectClipped.y2); QPointF p; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType t = inter.intersects(e, &p); +#else QLineF::IntersectType t = inter.intersect(e, &p); +#endif if (t == QLineF::BoundedIntersection) { *polygonPoints << p; } @@ -597,7 +609,11 @@ ViewerGL::Implementation::getWipePolygon(const RectD & texRectClipped, if (crossProd12 * crossProd11 < 0) { QLineF e(texRectClipped.x1, texRectClipped.y2, texRectClipped.x1, texRectClipped.y1); QPointF p; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QLineF::IntersectionType t = inter.intersects(e, &p); +#else QLineF::IntersectType t = inter.intersect(e, &p); +#endif if (t == QLineF::BoundedIntersection) { *polygonPoints << p; }