QLineF: mark angle(const QLineF&) as deprecated

QLineF::angle(const QLineF&) was deprecated during Qt4 times but not
decorated with QT_DEPRECATED_X. Add this so it can be removed with Qt6

Change-Id: I8950b646cc5fa8206e47bdd16647d17d615f6c6a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Christian Ehrlicher 2019-03-03 12:06:58 +01:00
parent ef0a77d872
commit 10ec683a96
5 changed files with 10 additions and 13 deletions

View File

@ -160,10 +160,7 @@ void XFormView::updateCtrlPoints(const QPolygonF &points)
ctrlPoints = points;
QLineF line(ctrlPoints.at(0), ctrlPoints.at(1));
m_rotation = line.angle(QLineF(0, 0, 1, 0));
if (line.dy() < 0)
m_rotation = 360 - m_rotation;
m_rotation = 360 - QLineF(0, 0, 1, 0).angleTo(line);
if (trans.isNull())
emit rotationChanged(int(m_rotation*10));
}

View File

@ -564,9 +564,7 @@ void GradientRenderer::paint(QPainter *p)
} else {
QLineF l(pts.at(0), pts.at(1));
qreal angle = l.angle(QLineF(0, 0, 1, 0));
if (l.dy() > 0)
angle = 360 - angle;
qreal angle = QLineF(0, 0, 1, 0).angleTo(l);
g = QConicalGradient(pts.at(0), angle);
}

View File

@ -805,6 +805,7 @@ qreal QLineF::angleTo(const QLineF &l) const
return delta_normalized;
}
#if QT_DEPRECATED_SINCE(5, 14)
/*!
\fn qreal QLineF::angle(const QLineF &line) const
@ -837,6 +838,7 @@ qreal QLineF::angle(const QLineF &l) const
if (cos_line >= -1.0 && cos_line <= 1.0) rad = qAcos( cos_line );
return rad * 360 / M_2PI;
}
#endif
#ifndef QT_NO_DEBUG_STREAM

View File

@ -251,7 +251,10 @@ public:
// ### Qt 6: rename intersects() or intersection() and rename IntersectType IntersectionType
IntersectType intersect(const QLineF &l, QPointF *intersectionPoint) const;
#if QT_DEPRECATED_SINCE(5, 14)
QT_DEPRECATED_X("Use angleTo() instead, take care that the return value is between 0 and 360 degree.")
qreal angle(const QLineF &l) const;
#endif
Q_DECL_CONSTEXPR inline QPointF pointAt(qreal t) const;
inline void translate(const QPointF &p);

View File

@ -173,15 +173,12 @@ template <class Iterator> bool qt_stroke_side(Iterator *it, QStroker *stroker,
bool capFirst, QLineF *startTangent);
/*******************************************************************************
* QLineF::angle gives us the smalles angle between two lines. Here we
* want to identify the line's angle direction on the unit circle.
* QLineF::angleTo gives us the angle between two lines with respecting the direction.
* Here we want to identify the line's angle direction on the unit circle.
*/
static inline qreal adapted_angle_on_x(const QLineF &line)
{
qreal angle = line.angle(QLineF(0, 0, 1, 0));
if (line.dy() > 0)
angle = 360 - angle;
return angle;
return QLineF(0, 0, 1, 0).angleTo(line);
}
QStrokerOps::QStrokerOps()