summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qline.cpp57
-rw-r--r--src/corelib/tools/qline.h9
-rw-r--r--tests/auto/corelib/tools/qline/tst_qline.cpp65
3 files changed, 3 insertions, 128 deletions
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 420ee4b64f..da66ada373 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -664,25 +664,6 @@ QLineF QLineF::unitVector() const
return f;
}
-#if QT_DEPRECATED_SINCE(5, 14)
-/*!
- \fn QLineF::IntersectType QLineF::intersect(const QLineF &line, QPointF *intersectionPoint) const
- \obsolete Use intersects() instead
-
- Returns a value indicating whether or not \e this line intersects
- with the given \a line.
-
- The actual intersection point is extracted to \a intersectionPoint
- (if the pointer is valid). If the lines are parallel, the
- intersection point is undefined.
-*/
-
-QLineF::IntersectType QLineF::intersect(const QLineF &l, QPointF *intersectionPoint) const
-{
- return intersects(l, intersectionPoint);
-}
-#endif
-
/*!
\fn QLineF::IntersectionType QLineF::intersects(const QLineF &line, QPointF *intersectionPoint) const
\since 5.14
@@ -831,42 +812,6 @@ qreal QLineF::angleTo(const QLineF &l) const
return delta_normalized;
}
-#if QT_DEPRECATED_SINCE(5, 14)
-/*!
- \fn qreal QLineF::angle(const QLineF &line) const
-
- \obsolete
-
- Returns the angle (in degrees) between this line and the given \a
- line, taking the direction of the lines into account. If the lines
- do not intersect within their range, it is the intersection point of
- the extended lines that serves as origin (see
- QLineF::UnboundedIntersection).
-
- \table
- \row
- \li \inlineimage qlinef-angle-identicaldirection.png
- \li \inlineimage qlinef-angle-oppositedirection.png
- \endtable
-
- When the lines are parallel, this function returns 0 if they have
- the same direction; otherwise it returns 180.
-
- \sa intersect()
-*/
-qreal QLineF::angle(const QLineF &l) const
-{
- if (isNull() || l.isNull())
- return 0;
- qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length());
- qreal rad = 0;
- // only accept cos_line in the range [-1,1], if it is outside, use 0 (we return 0 rather than PI for those cases)
- if (cos_line >= -1.0 && cos_line <= 1.0) rad = qAcos( cos_line );
- return rad * 360 / M_2PI;
-}
-#endif
-
-
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QLineF &p)
{
diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h
index d4f62024d1..8d0e10b669 100644
--- a/src/corelib/tools/qline.h
+++ b/src/corelib/tools/qline.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -251,13 +251,6 @@ public:
IntersectionType intersects(const QLineF &l, QPointF *intersectionPoint) const;
-#if QT_DEPRECATED_SINCE(5, 14)
- QT_DEPRECATED_VERSION_X(5, 14, "Use intersects() instead")
- IntersectType intersect(const QLineF &l, QPointF *intersectionPoint) const;
- QT_DEPRECATED_X("Use qMin(l1.angleTo(l2), l2.angleTo(l1)) instead")
- qreal angle(const QLineF &l) const;
-#endif
-
Q_DECL_CONSTEXPR inline QPointF pointAt(qreal t) const;
inline void translate(const QPointF &p);
inline void translate(qreal dx, qreal dy);
diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp
index 2707dea146..4f3be0f3d9 100644
--- a/tests/auto/corelib/tools/qline/tst_qline.cpp
+++ b/tests/auto/corelib/tools/qline/tst_qline.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -30,10 +30,6 @@
#include <qline.h>
#include <qmath.h>
-#ifndef M_2PI
-#define M_2PI 6.28318530717958647692528676655900576
-#endif
-
class tst_QLine : public QObject
{
Q_OBJECT
@@ -53,11 +49,6 @@ private slots:
void testNormalVector();
void testNormalVector_data();
-#if QT_DEPRECATED_SINCE(5, 14)
- void testAngle();
- void testAngle_data();
-#endif
-
void testAngle2();
void testAngle2_data();
@@ -202,9 +193,6 @@ void tst_QLine::testIntersection()
QPointF ip;
QLineF::IntersectionType itype = a.intersects(b, &ip);
-#if QT_DEPRECATED_SINCE(5, 14)
- QCOMPARE(a.intersect(b, &ip), itype);
-#endif
QCOMPARE(int(itype), type);
if (type != QLineF::NoIntersection) {
@@ -377,57 +365,6 @@ void tst_QLine::testNormalVector()
QCOMPARE(n.dy(), qreal(nvy));
}
-#if QT_DEPRECATED_SINCE(5, 14)
-void tst_QLine::testAngle_data()
-{
- QTest::addColumn<double>("xa1");
- QTest::addColumn<double>("ya1");
- QTest::addColumn<double>("xa2");
- QTest::addColumn<double>("ya2");
- QTest::addColumn<double>("xb1");
- QTest::addColumn<double>("yb1");
- QTest::addColumn<double>("xb2");
- QTest::addColumn<double>("yb2");
- QTest::addColumn<double>("angle");
-
- QTest::newRow("parallel") << 1.0 << 1.0 << 3.0 << 4.0
- << 5.0 << 6.0 << 7.0 << 9.0
- << 0.0;
- QTest::newRow("[4,4]-[4,0]") << 1.0 << 1.0 << 5.0 << 5.0
- << 0.0 << 4.0 << 3.0 << 4.0
- << 45.0;
- QTest::newRow("[4,4]-[-4,0]") << 1.0 << 1.0 << 5.0 << 5.0
- << 3.0 << 4.0 << 0.0 << 4.0
- << 135.0;
-
- for (int i=0; i<180; ++i) {
- QTest::newRow(("angle:" + QByteArray::number(i)).constData())
- << 0.0 << 0.0 << double(cos(i*M_2PI/360)) << double(sin(i*M_2PI/360))
- << 0.0 << 0.0 << 1.0 << 0.0
- << double(i);
- }
-}
-
-void tst_QLine::testAngle()
-{
- QFETCH(double, xa1);
- QFETCH(double, ya1);
- QFETCH(double, xa2);
- QFETCH(double, ya2);
- QFETCH(double, xb1);
- QFETCH(double, yb1);
- QFETCH(double, xb2);
- QFETCH(double, yb2);
- QFETCH(double, angle);
-
- QLineF a(xa1, ya1, xa2, ya2);
- QLineF b(xb1, yb1, xb2, yb2);
-
- double resultAngle = a.angle(b);
- QCOMPARE(qRound(resultAngle), qRound(angle));
-}
-#endif
-
void tst_QLine::testAngle2_data()
{
QTest::addColumn<qreal>("x1");