summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qline.cpp
diff options
context:
space:
mode:
authorLorenz Haas <lorenz.haas@histomatics.de>2016-05-01 22:47:01 +0200
committerLorenz Haas <lorenz.haas@histomatics.de>2016-05-27 08:49:44 +0000
commita7372fd79d9416d4b0de3d47ef869aff12048aa3 (patch)
tree8aeed4c5c5cf0aea1f1a87476eb750c5d9cfb187 /src/corelib/tools/qline.cpp
parent72e084165e1e935e2ddf030481f18a77ea5b3cc2 (diff)
Add QLineF::center() returning the point in the center of the line
[ChangeLog][QtCore][QLine/QLineF] Added center(). Change-Id: I6dcfa9e839190c0a4caf36fb6ecd01b37d65d274 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/tools/qline.cpp')
-rw-r--r--src/corelib/tools/qline.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index b004f74be9..8942292a3d 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -214,6 +214,14 @@ QT_BEGIN_NAMESPACE
Returns this line translated the distance specified by \a dx and \a dy.
*/
+/*!
+ \fn QPoint QLine::center() const
+
+ \since 5.8
+
+ Returns the center point of this line. This is equivalent to
+ (p1() + p2()) / 2, except it will never overflow.
+*/
/*!
\fn void QLine::setP1(const QPoint &p1)
@@ -351,6 +359,12 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
translate() function, and can be traversed using the pointAt()
function.
+ \section1 Constraints
+
+ QLine is limited to the minimum and maximum values for the
+ \c int type. Operations on a QLine that could potentially result
+ in values outside this range will result in undefined behavior.
+
\sa QLine, QPolygonF, QRectF
*/
@@ -711,6 +725,15 @@ QLineF::IntersectType QLineF::intersect(const QLineF &l, QPointF *intersectionPo
*/
/*!
+ \fn QPointF QLineF::center() const
+
+ \since 5.8
+
+ Returns the center point of this line. This is equivalent to
+ 0.5 * p1() + 0.5 * p2().
+*/
+
+/*!
\fn void QLineF::setP1(const QPointF &p1)
\since 4.4