diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-02-16 07:42:11 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-20 15:17:08 +0100 |
commit | f9327fecc1dca707a10b52ffe13b0240320b85fe (patch) | |
tree | 90891353d87886581631b7eb5066f9aa93251314 /src/corelib/tools/qpoint.cpp | |
parent | 3c21a62cbe7944e6e65681c50664ca0aacda6e16 (diff) |
QPoint/QPointF: inline manhattanLength(); QLineF: inline isNull()
There's no reason for them not to be, and it's a prerequisite
for making these functions constexpr.
Change-Id: I03c9965147b51014c7af60a4c2d7f25a3f6e21a7
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/corelib/tools/qpoint.cpp')
-rw-r--r-- | src/corelib/tools/qpoint.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp index 55a2261cb9..ecbe9deb9f 100644 --- a/src/corelib/tools/qpoint.cpp +++ b/src/corelib/tools/qpoint.cpp @@ -402,6 +402,8 @@ QDataStream &operator>>(QDataStream &s, QPoint &p) #endif // QT_NO_DATASTREAM /*! + \fn int QPoint::manhattanLength() const + Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" of the vector from the origin to the point. For example: @@ -417,10 +419,6 @@ QDataStream &operator>>(QDataStream &s, QPoint &p) apply to travelers who can only travel on a rectangular grid, like the streets of Manhattan. */ -int QPoint::manhattanLength() const -{ - return qAbs(x())+qAbs(y()); -} #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QPoint &p) { @@ -505,6 +503,7 @@ QDebug operator<<(QDebug d, const QPointF &p) /*! + \fn qreal QPointF::manhattanLength() const \since 4.6 Returns the sum of the absolute values of x() and y(), @@ -513,10 +512,6 @@ QDebug operator<<(QDebug d, const QPointF &p) \sa QPoint::manhattanLength() */ -qreal QPointF::manhattanLength() const -{ - return qAbs(x())+qAbs(y()); -} /*! \fn qreal QPointF::x() const |