diff options
Diffstat (limited to 'src/corelib/tools/qpoint.h')
-rw-r--r-- | src/corelib/tools/qpoint.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index b6446e8c9f..69403ebc53 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -44,8 +44,6 @@ #include <QtCore/qnamespace.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -76,6 +74,9 @@ public: inline QPoint &operator/=(qreal divisor); + Q_DECL_CONSTEXPR static inline int dotProduct(const QPoint &p1, const QPoint &p2) + { return p1.xp * p2.xp + p1.yp * p2.yp; } + friend Q_DECL_CONSTEXPR inline bool operator==(const QPoint &, const QPoint &); friend Q_DECL_CONSTEXPR inline bool operator!=(const QPoint &, const QPoint &); friend Q_DECL_CONSTEXPR inline const QPoint operator+(const QPoint &, const QPoint &); @@ -233,6 +234,9 @@ public: inline QPointF &operator*=(qreal c); inline QPointF &operator/=(qreal c); + Q_DECL_CONSTEXPR static inline qreal dotProduct(const QPointF &p1, const QPointF &p2) + { return p1.xp * p2.xp + p1.yp * p2.yp; } + friend Q_DECL_CONSTEXPR inline bool operator==(const QPointF &, const QPointF &); friend Q_DECL_CONSTEXPR inline bool operator!=(const QPointF &, const QPointF &); friend Q_DECL_CONSTEXPR inline const QPointF operator+(const QPointF &, const QPointF &); @@ -393,6 +397,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug d, const QPointF &p); QT_END_NAMESPACE -QT_END_HEADER - #endif // QPOINT_H |