From f9327fecc1dca707a10b52ffe13b0240320b85fe Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 16 Feb 2012 07:42:11 +0100 Subject: 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 Reviewed-by: Gunnar Sletta --- src/corelib/tools/qpoint.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/corelib/tools/qpoint.h') diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index 827de3936c..2e987fcf41 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -130,6 +130,9 @@ inline void QPoint::setX(int xpos) inline void QPoint::setY(int ypos) { yp = ypos; } +inline int QPoint::manhattanLength() const +{ return qAbs(x())+qAbs(y()); } + inline int &QPoint::rx() { return xp; } @@ -267,6 +270,11 @@ inline QPointF::QPointF(qreal xpos, qreal ypos) : xp(xpos), yp(ypos) { } inline QPointF::QPointF(const QPoint &p) : xp(p.x()), yp(p.y()) { } +inline qreal QPointF::manhattanLength() const +{ + return qAbs(x())+qAbs(y()); +} + inline bool QPointF::isNull() const { return qIsNull(xp) && qIsNull(yp); -- cgit v1.2.3