From 4b2e569e942de2d52354d9e81951f6e31d5329dc Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 26 Jul 2024 10:06:56 -0700 Subject: [PATCH] core/types: allow implicit conversion from point to box --- src/core/types.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/types.hpp b/src/core/types.hpp index e2b43e59..43224d82 100644 --- a/src/core/types.hpp +++ b/src/core/types.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -21,6 +22,7 @@ public: Box(qint32 x, qint32 y, qint32 w, qint32 h): x(x), y(y), w(w), h(h) {} Q_INVOKABLE Box(const QRect& rect): x(rect.x()), y(rect.y()), w(rect.width()), h(rect.height()) {} + Q_INVOKABLE Box(const QPoint& rect): x(rect.x()), y(rect.y()) {} Q_INVOKABLE Box(const QRectF& rect) : x(static_cast(rect.x())) @@ -28,6 +30,10 @@ public: , w(static_cast(rect.width())) , h(static_cast(rect.height())) {} + Q_INVOKABLE Box(const QPointF& rect) + : x(static_cast(rect.x())) + , y(static_cast(rect.y())) {} + bool operator==(const Box& other) const; qint32 x = 0;