Suggest to add functions to QRect and QRectF
-
Hi,
QRect and QRectF have functions to get center() and corner points like topLeft(), topRight(), bottomLeft(), bottomRight() .
So I suggest to add functions to get other middle points like topCenter(), bottomCenter(), centerLeft(), centerRight().Q_DECL_CONSTEXPR inline QPoint QRect::topCenter() const Q_DECL_NOTHROW { return QPoint(x1 + x2 / 2, y1 / 2); }
Q_DECL_CONSTEXPR inline QPoint QRect::bottomCenter() const Q_DECL_NOTHROW { return QPoint(x1 + x2 / 2, y1 + y2); }
Q_DECL_CONSTEXPR inline QPoint QRect::centerLeft() const Q_DECL_NOTHROW { return QPoint(x1, y1 + y2 / 2); }
Q_DECL_CONSTEXPR inline QPoint QRect::centerRight() const Q_DECL_NOTHROW { return QPoint(x1 + x2, y1 + y2 / 2); }Q_DECL_CONSTEXPR inline QPointF QRectF::topCenter() const Q_DECL_NOTHROW { return QPointF(xp + w / 2, yp); }
Q_DECL_CONSTEXPR inline QPointF QRectF::bottomCenter() const Q_DECL_NOTHROW { return QPointF(xp + w / 2, yp + h); }
Q_DECL_CONSTEXPR inline QPointF QRectF::centerLeft() const Q_DECL_NOTHROW { return QPointF(xp, yp + h / 2); }
Q_DECL_CONSTEXPR inline QPointF QRectF::centerRight() const Q_DECL_NOTHROW { return QPointF(xp + w, yp + h / 2); }thanks.
-
@AbdulRahman-Ahmad You should do such suggestions in Qt Bugtracker: https://bugreports.qt.io/secure/Dashboard.jspa
This forum is for users, Qt developers will most probably not read your suggestion here.