QLineF::IntersectType QLineF::intersect(const QLineF&, QPointF*) const' is

deprecated: Use intersects() instead.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2020-01-06 18:34:35 +02:00
parent 8ab0ebeb12
commit e8bb4c2af3
13 changed files with 177 additions and 0 deletions

View File

@ -105,7 +105,11 @@ qreal CSR(qreal length, qreal split, qreal arcLength)
tmp.setAngle(tmp.angle()+angle*sign); tmp.setAngle(tmp.angle()+angle*sign);
QPointF crosPoint; QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const auto type = line.intersects(tmp, &crosPoint);
#else
const auto type = line.intersect(tmp, &crosPoint); const auto type = line.intersect(tmp, &crosPoint);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return 0; return 0;

View File

@ -334,7 +334,12 @@ QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &poin
for ( auto i = 0; i < points.count()-1; ++i ) for ( auto i = 0; i < points.count()-1; ++i )
{ {
QPointF crosPoint; QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const auto type = line.intersects(QLineF(points.at(i), points.at(i+1)), &crosPoint);
#else
const auto type = line.intersect(QLineF(points.at(i), points.at(i+1)), &crosPoint); const auto type = line.intersect(QLineF(points.at(i), points.at(i+1)), &crosPoint);
#endif
if ( type == QLineF::BoundedIntersection ) if ( type == QLineF::BoundedIntersection )
{ {
intersections.append(crosPoint); intersections.append(crosPoint);

View File

@ -299,22 +299,45 @@ QPointF VGObject::LineIntersectRect(const QRectF &rec, const QLineF &line)
qreal x1, y1, x2, y2; qreal x1, y1, x2, y2;
rec.getCoords(&x1, &y1, &x2, &y2); rec.getCoords(&x1, &y1, &x2, &y2);
QPointF point; QPointF point;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = line.intersects(QLineF(QPointF(x1, y1), QPointF(x1, y2)), &point);
#else
QLineF::IntersectType type = line.intersect(QLineF(QPointF(x1, y1), QPointF(x1, y2)), &point); QLineF::IntersectType type = line.intersect(QLineF(QPointF(x1, y1), QPointF(x1, y2)), &point);
#endif
if ( type == QLineF::BoundedIntersection ) if ( type == QLineF::BoundedIntersection )
{ {
return point; return point;
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = line.intersects(QLineF(QPointF(x1, y1), QPointF(x2, y1)), &point);
#else
type = line.intersect(QLineF(QPointF(x1, y1), QPointF(x2, y1)), &point); type = line.intersect(QLineF(QPointF(x1, y1), QPointF(x2, y1)), &point);
#endif
if ( type == QLineF::BoundedIntersection ) if ( type == QLineF::BoundedIntersection )
{ {
return point; return point;
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = line.intersects(QLineF(QPointF(x1, y2), QPointF(x2, y2)), &point);
#else
type = line.intersect(QLineF(QPointF(x1, y2), QPointF(x2, y2)), &point); type = line.intersect(QLineF(QPointF(x1, y2), QPointF(x2, y2)), &point);
#endif
if ( type == QLineF::BoundedIntersection ) if ( type == QLineF::BoundedIntersection )
{ {
return point; return point;
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = line.intersects(QLineF(QPointF(x2, y1), QPointF(x2, y2)), &point);
#else
type = line.intersect(QLineF(QPointF(x2, y1), QPointF(x2, y2)), &point); type = line.intersect(QLineF(QPointF(x2, y1), QPointF(x2, y2)), &point);
#endif
if ( type == QLineF::BoundedIntersection ) if ( type == QLineF::BoundedIntersection )
{ {
return point; return point;
@ -426,7 +449,12 @@ QPointF VGObject::ClosestPoint(const QLineF &line, const QPointF &point)
qreal y = b + point.y(); qreal y = b + point.y();
QLineF lin (point, QPointF(x, y)); QLineF lin (point, QPointF(x, y));
QPointF p; QPointF p;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = line.intersects(lin, &p);
#else
QLineF::IntersectType intersect = line.intersect(lin, &p); QLineF::IntersectType intersect = line.intersect(lin, &p);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{ {
return p; return p;

View File

@ -207,7 +207,12 @@ QVector<QPointF> AngleByLength(QVector<QPointF> points, QPointF p2, const QLineF
// We do not check intersection type because intersection must alwayse exist // We do not check intersection type because intersection must alwayse exist
QPointF px; QPointF px;
cutLine.setAngle(cutLine.angle()+90); cutLine.setAngle(cutLine.angle()+90);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = QLineF(sp1, sp2).intersects(cutLine, &px);
#else
QLineF::IntersectType type = QLineF(sp1, sp2).intersect(cutLine, &px); QLineF::IntersectType type = QLineF(sp1, sp2).intersect(cutLine, &px);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
qDebug()<<"Couldn't find intersection with cut line."; qDebug()<<"Couldn't find intersection with cut line.";
@ -215,7 +220,12 @@ QVector<QPointF> AngleByLength(QVector<QPointF> points, QPointF p2, const QLineF
points.append(px); points.append(px);
cutLine.setAngle(cutLine.angle()-180); cutLine.setAngle(cutLine.angle()-180);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = QLineF(sp2, sp3).intersects(cutLine, &px);
#else
type = QLineF(sp2, sp3).intersect(cutLine, &px); type = QLineF(sp2, sp3).intersect(cutLine, &px);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
qDebug()<<"Couldn't find intersection with cut line."; qDebug()<<"Couldn't find intersection with cut line.";
@ -286,7 +296,12 @@ QVector<QPointF> AngleByIntersection(const QVector<QPointF> &points, QPointF p1,
QLineF edge2(p2, p3); QLineF edge2(p2, p3);
QPointF px; QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = edge2.intersects(bigLine1, &px);
#else
QLineF::IntersectType type = edge2.intersect(bigLine1, &px); QLineF::IntersectType type = edge2.intersect(bigLine1, &px);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback); return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -314,7 +329,12 @@ QVector<QPointF> AngleByIntersection(const QVector<QPointF> &points, QPointF p1,
// Second point // Second point
QLineF edge1(p1, p2); QLineF edge1(p1, p2);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = edge1.intersects(bigLine2, &px);
#else
type = edge1.intersect(bigLine2, &px); type = edge1.intersect(bigLine2, &px);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback); return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -351,14 +371,24 @@ QVector<QPointF> AngleByFirstSymmetry(const QVector<QPointF> &points, QPointF p1
QLineF sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2())); QLineF sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2()));
QPointF px1; QPointF px1;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = sEdge.intersects(bigLine1, &px1);
#else
QLineF::IntersectType type = sEdge.intersect(bigLine1, &px1); QLineF::IntersectType type = sEdge.intersect(bigLine1, &px1);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback); return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback);
} }
QPointF px2; QPointF px2;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = sEdge.intersects(bigLine2, &px2);
#else
type = sEdge.intersect(bigLine2, &px2); type = sEdge.intersect(bigLine2, &px2);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback); return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -411,14 +441,24 @@ QVector<QPointF> AngleBySecondSymmetry(const QVector<QPointF> &points, QPointF p
QLineF sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2())); QLineF sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2()));
QPointF px1; QPointF px1;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = sEdge.intersects(bigLine1, &px1);
#else
QLineF::IntersectType type = sEdge.intersect(bigLine1, &px1); QLineF::IntersectType type = sEdge.intersect(bigLine1, &px1);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback); return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback);
} }
QPointF px2; QPointF px2;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
type = sEdge.intersects(bigLine2, &px2);
#else
type = sEdge.intersect(bigLine2, &px2); type = sEdge.intersect(bigLine2, &px2);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback); return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -474,7 +514,12 @@ QVector<QPointF> AngleByFirstRightAngle(const QVector<QPointF> &points, QPointF
QLineF edge(p1, p2); QLineF edge(p1, p2);
QPointF px; QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = edge.intersects(bigLine2, &px);
#else
QLineF::IntersectType type = edge.intersect(bigLine2, &px); QLineF::IntersectType type = edge.intersect(bigLine2, &px);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback); return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -524,7 +569,12 @@ QVector<QPointF> AngleBySecondRightAngle(QVector<QPointF> points, QPointF p2, QP
QLineF edge(p2, p3); QLineF edge(p2, p3);
QPointF px; QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = edge.intersects(bigLine1, &px);
#else
QLineF::IntersectType type = edge.intersect(bigLine1, &px); QLineF::IntersectType type = edge.intersect(bigLine1, &px);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback); return AngleByLength(points, p2, bigLine1, sp2, bigLine2, p, width, needRollback);
@ -987,7 +1037,11 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
const QLineF bigLine1 = ParallelLine(points.at(points.size()-2), points.at(0), width); const QLineF bigLine1 = ParallelLine(points.at(points.size()-2), points.at(0), width);
QPointF px; QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
edge.intersects(bigLine1, &px);
#else
edge.intersect(bigLine1, &px); edge.intersect(bigLine1, &px);
#endif
ekvPoints.removeLast(); ekvPoints.removeLast();
@ -1121,7 +1175,12 @@ QVector<QPointF> VAbstractPiece::CheckLoops(const QVector<QPointF> &points)
// For closed path last point is equal to first. Using index of the first. // For closed path last point is equal to first. Using index of the first.
pathClosed && jNext == count-1 ? AddUniqueIndex(0) : AddUniqueIndex(jNext); pathClosed && jNext == count-1 ? AddUniqueIndex(0) : AddUniqueIndex(jNext);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType intersect = line1.intersects(line2, &crosPoint);
#else
const QLineF::IntersectType intersect = line1.intersect(line2, &crosPoint); const QLineF::IntersectType intersect = line1.intersect(line2, &crosPoint);
#endif
if (intersect == QLineF::NoIntersection) if (intersect == QLineF::NoIntersection)
{ // According to the documentation QLineF::NoIntersection indicates that the lines do not intersect; { // According to the documentation QLineF::NoIntersection indicates that the lines do not intersect;
// i.e. they are parallel. But parallel also mean they can be on the same line. // i.e. they are parallel. But parallel also mean they can be on the same line.
@ -1137,12 +1196,20 @@ QVector<QPointF> VAbstractPiece::CheckLoops(const QVector<QPointF> &points)
tmpLine1.setAngle(tmpLine1.angle()+90); tmpLine1.setAngle(tmpLine1.angle()+90);
QPointF tmpCrosPoint; QPointF tmpCrosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType tmpIntrs1 = tmpLine1.intersects(tmpLine2, &tmpCrosPoint);
#else
const QLineF::IntersectType tmpIntrs1 = tmpLine1.intersect(tmpLine2, &tmpCrosPoint); const QLineF::IntersectType tmpIntrs1 = tmpLine1.intersect(tmpLine2, &tmpCrosPoint);
#endif
tmpLine1 = line1; tmpLine1 = line1;
tmpLine2.setAngle(tmpLine2.angle()+90); tmpLine2.setAngle(tmpLine2.angle()+90);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType tmpIntrs2 = tmpLine1.intersects(tmpLine2, &tmpCrosPoint);
#else
const QLineF::IntersectType tmpIntrs2 = tmpLine1.intersect(tmpLine2, &tmpCrosPoint); const QLineF::IntersectType tmpIntrs2 = tmpLine1.intersect(tmpLine2, &tmpCrosPoint);
#endif
if (tmpIntrs1 == QLineF::BoundedIntersection || tmpIntrs2 == QLineF::BoundedIntersection) if (tmpIntrs1 == QLineF::BoundedIntersection || tmpIntrs2 == QLineF::BoundedIntersection)
{ // Now we really sure that lines are on the same lines and have real intersections. { // Now we really sure that lines are on the same lines and have real intersections.
@ -1228,7 +1295,12 @@ QVector<QPointF> VAbstractPiece::EkvPoint(QVector<QPointF> points, const VSAPoin
} }
QPointF crosPoint; QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType type = bigLine1.intersects( bigLine2, &crosPoint );
#else
const QLineF::IntersectType type = bigLine1.intersect( bigLine2, &crosPoint ); const QLineF::IntersectType type = bigLine1.intersect( bigLine2, &crosPoint );
#endif
switch (type) switch (type)
{// There are at least three big cases {// There are at least three big cases
case (QLineF::BoundedIntersection): case (QLineF::BoundedIntersection):
@ -1319,7 +1391,12 @@ QT_WARNING_POP
const QLineF bigEdge = ParallelLine(p1Line1, p1Line2, localWidth ); const QLineF bigEdge = ParallelLine(p1Line1, p1Line2, localWidth );
QPointF px; QPointF px;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType type = bigEdge.intersects(line, &px);
#else
const QLineF::IntersectType type = bigEdge.intersect(line, &px); const QLineF::IntersectType type = bigEdge.intersect(line, &px);
#endif
if (type != QLineF::BoundedIntersection) if (type != QLineF::BoundedIntersection)
{ {
if (line.length() < QLineF(p2Line1, px).length()) if (line.length() < QLineF(p2Line1, px).length())
@ -1507,7 +1584,12 @@ QVector<QPointF> VAbstractPiece::RollbackSeamAllowance(QVector<QPointF> points,
{ {
QLineF segment(points.at(i), points.at(i-1)); QLineF segment(points.at(i), points.at(i-1));
QPointF crosPoint; QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType type = cuttingEdge.intersects(segment, &crosPoint);
#else
const QLineF::IntersectType type = cuttingEdge.intersect(segment, &crosPoint); const QLineF::IntersectType type = cuttingEdge.intersect(segment, &crosPoint);
#endif
if (type != QLineF::NoIntersection if (type != QLineF::NoIntersection
&& VGObject::IsPointOnLineSegment(crosPoint, segment.p1(), segment.p2()) && VGObject::IsPointOnLineSegment(crosPoint, segment.p1(), segment.p2())
&& IsOutsidePoint(cuttingEdge.p2(), cuttingEdge.p1(), crosPoint)) && IsOutsidePoint(cuttingEdge.p2(), cuttingEdge.p1(), crosPoint))
@ -1527,7 +1609,12 @@ QVector<QPointF> VAbstractPiece::RollbackSeamAllowance(QVector<QPointF> points,
{ {
QPointF crosPoint; QPointF crosPoint;
QLineF secondLast(points.at(points.size()-2), points.at(points.size()-1)); QLineF secondLast(points.at(points.size()-2), points.at(points.size()-1));
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType type = secondLast.intersects(cuttingEdge, &crosPoint);
#else
QLineF::IntersectType type = secondLast.intersect(cuttingEdge, &crosPoint); QLineF::IntersectType type = secondLast.intersect(cuttingEdge, &crosPoint);
#endif
if (type != QLineF::NoIntersection && IsOutsidePoint(secondLast.p1(), secondLast.p2(), crosPoint)) if (type != QLineF::NoIntersection && IsOutsidePoint(secondLast.p1(), secondLast.p2(), crosPoint))
{ {
points.append(crosPoint); points.append(crosPoint);

View File

@ -227,7 +227,11 @@ void DialogLineIntersect::PointNameChanged()
QLineF line1(static_cast<QPointF>(*p1Line1), static_cast<QPointF>(*p2Line1)); QLineF line1(static_cast<QPointF>(*p1Line1), static_cast<QPointF>(*p2Line1));
QLineF line2(static_cast<QPointF>(*p1Line2), static_cast<QPointF>(*p2Line2)); QLineF line2(static_cast<QPointF>(*p1Line2), static_cast<QPointF>(*p2Line2));
QPointF fPoint; QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = line1.intersects(line2, &fPoint);
#else
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint); QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
#endif
flagError = not (set.size() < 3 || intersect == QLineF::NoIntersection); flagError = not (set.size() < 3 || intersect == QLineF::NoIntersection);
QColor color = flagError ? okColor : errorColor; QColor color = flagError ? okColor : errorColor;
@ -269,7 +273,12 @@ bool DialogLineIntersect::CheckIntersecion()
QLineF line1(static_cast<QPointF>(*p1L1), static_cast<QPointF>(*p2L1)); QLineF line1(static_cast<QPointF>(*p1L1), static_cast<QPointF>(*p2L1));
QLineF line2(static_cast<QPointF>(*p1L2), static_cast<QPointF>(*p2L2)); QLineF line2(static_cast<QPointF>(*p1L2), static_cast<QPointF>(*p2L2));
QPointF fPoint; QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = line1.intersects(line2, &fPoint);
#else
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint); QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{ {
return true; return true;

View File

@ -78,7 +78,11 @@ void VToolTrueDarts::FindPoint(const QPointF &baseLineP1, const QPointF &baseLin
QLineF d2blP2(dartP2, baseLineP2); QLineF d2blP2(dartP2, baseLineP2);
d2blP2.setAngle(d2blP2.angle()+degrees); d2blP2.setAngle(d2blP2.angle()+degrees);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
if (QLineF(baseLineP1, d2blP2.p2()).intersects(d2d1, &p1) == QLineF::NoIntersection)
#else
if (QLineF(baseLineP1, d2blP2.p2()).intersect(d2d1, &p1) == QLineF::NoIntersection) if (QLineF(baseLineP1, d2blP2.p2()).intersect(d2d1, &p1) == QLineF::NoIntersection)
#endif
{ {
p1 = QPointF(0, 0); p1 = QPointF(0, 0);
p2 = QPointF(0, 0); p2 = QPointF(0, 0);

View File

@ -179,7 +179,12 @@ bool VToolLineIntersectAxis::FindPoint(const QLineF &axis, const QLineF &line, Q
SCASSERT(intersectionPoint != nullptr) SCASSERT(intersectionPoint != nullptr)
QPointF fPoint; QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = axis.intersects(line, &fPoint);
#else
QLineF::IntersectType intersect = axis.intersect(line, &fPoint); QLineF::IntersectType intersect = axis.intersect(line, &fPoint);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{ {
if(VFuzzyComparePossibleNulls(axis.angle(), line.angle()) if(VFuzzyComparePossibleNulls(axis.angle(), line.angle())

View File

@ -140,7 +140,12 @@ VToolLineIntersect* VToolLineIntersect::Create(VToolLineIntersectInitData initDa
QLineF line1(static_cast<QPointF>(*p1Line1), static_cast<QPointF>(*p2Line1)); QLineF line1(static_cast<QPointF>(*p1Line1), static_cast<QPointF>(*p2Line1));
QLineF line2(static_cast<QPointF>(*p1Line2), static_cast<QPointF>(*p2Line2)); QLineF line2(static_cast<QPointF>(*p1Line2), static_cast<QPointF>(*p2Line2));
QPointF fPoint; QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QLineF::IntersectType intersect = line1.intersects(line2, &fPoint);
#else
const QLineF::IntersectType intersect = line1.intersect(line2, &fPoint); const QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
#endif
if (intersect == QLineF::NoIntersection) if (intersect == QLineF::NoIntersection)
{ {
qWarning() << tr("Error calculating point '%1'. Lines (%2;%3) and (%4;%5) have no point of intersection") qWarning() << tr("Error calculating point '%1'. Lines (%2;%3) and (%4;%5) have no point of intersection")

View File

@ -200,7 +200,12 @@ bool VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, cons
QLineF hypotenuse(firstPoint, secondPoint); QLineF hypotenuse(firstPoint, secondPoint);
QPointF startPoint; QPointF startPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = axis.intersects(hypotenuse, &startPoint);
#else
QLineF::IntersectType intersect = axis.intersect(hypotenuse, &startPoint); QLineF::IntersectType intersect = axis.intersect(hypotenuse, &startPoint);
#endif
if (intersect != QLineF::UnboundedIntersection && intersect != QLineF::BoundedIntersection) if (intersect != QLineF::UnboundedIntersection && intersect != QLineF::BoundedIntersection)
{ {
return false; return false;

View File

@ -116,7 +116,12 @@ void VisToolHeight::setLineP2Id(const quint32 &value)
void VisToolHeight::ShowIntersection(const QLineF &height_line, const QLineF &base_line) void VisToolHeight::ShowIntersection(const QLineF &height_line, const QLineF &base_line)
{ {
QPointF p; QPointF p;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = height_line.intersects(base_line, &p);
#else
QLineF::IntersectType intersect = height_line.intersect(base_line, &p); QLineF::IntersectType intersect = height_line.intersect(base_line, &p);
#endif
if (intersect == QLineF::UnboundedIntersection) if (intersect == QLineF::UnboundedIntersection)
{ {
line_intersection->setVisible(true); line_intersection->setVisible(true);

View File

@ -87,7 +87,12 @@ void VisToolLineIntersect::RefreshGeometry()
QLineF l1(static_cast<QPointF>(*first), static_cast<QPointF>(*second)); QLineF l1(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
QLineF l2(static_cast<QPointF>(*third), Visualization::scenePos); QLineF l2(static_cast<QPointF>(*third), Visualization::scenePos);
QPointF fPoint; QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = l1.intersects(l2, &fPoint);
#else
QLineF::IntersectType intersect = l1.intersect(l2, &fPoint); QLineF::IntersectType intersect = l1.intersect(l2, &fPoint);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{ {
DrawPoint(point, fPoint, mainColor); DrawPoint(point, fPoint, mainColor);
@ -103,7 +108,12 @@ void VisToolLineIntersect::RefreshGeometry()
QLineF l1(static_cast<QPointF>(*first), static_cast<QPointF>(*second)); QLineF l1(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
QLineF l2(static_cast<QPointF>(*third), static_cast<QPointF>(*forth)); QLineF l2(static_cast<QPointF>(*third), static_cast<QPointF>(*forth));
QPointF fPoint; QPointF fPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = l1.intersects(l2, &fPoint);
#else
QLineF::IntersectType intersect = l1.intersect(l2, &fPoint); QLineF::IntersectType intersect = l1.intersect(l2, &fPoint);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{ {
DrawPoint(point, fPoint, mainColor); DrawPoint(point, fPoint, mainColor);

View File

@ -138,7 +138,12 @@ void VisToolLineIntersectAxis::setAxisPointId(const quint32 &value)
void VisToolLineIntersectAxis::ShowIntersection(const QLineF &axis_line, const QLineF &base_line) void VisToolLineIntersectAxis::ShowIntersection(const QLineF &axis_line, const QLineF &base_line)
{ {
QPointF p; QPointF p;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = axis_line.intersects(base_line, &p);
#else
QLineF::IntersectType intersect = axis_line.intersect(base_line, &p); QLineF::IntersectType intersect = axis_line.intersect(base_line, &p);
#endif
if (intersect == QLineF::UnboundedIntersection) if (intersect == QLineF::UnboundedIntersection)
{ {
line_intersection->setVisible(true); line_intersection->setVisible(true);

View File

@ -97,7 +97,12 @@ void VisToolPointOfIntersection::setPoint2Id(const quint32 &value)
void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLineF &axis2, const QColor &color) void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLineF &axis2, const QColor &color)
{ {
QPointF p; QPointF p;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersect = axis1.intersects(axis2, &p);
#else
QLineF::IntersectType intersect = axis1.intersect(axis2, &p); QLineF::IntersectType intersect = axis1.intersect(axis2, &p);
#endif
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{ {
point->setVisible(true); point->setVisible(true);