summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qpoint.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-02-16 07:42:11 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-20 15:17:08 +0100
commitf9327fecc1dca707a10b52ffe13b0240320b85fe (patch)
tree90891353d87886581631b7eb5066f9aa93251314 /src/corelib/tools/qpoint.h
parent3c21a62cbe7944e6e65681c50664ca0aacda6e16 (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.h')
-rw-r--r--src/corelib/tools/qpoint.h8
1 files changed, 8 insertions, 0 deletions
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);