diff options
Diffstat (limited to 'src/corelib/tools/qpoint.h')
-rw-r--r-- | src/corelib/tools/qpoint.h | 8 |
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); |