From c7aa3a69253c82b8ae814c88ebbdfad7e48d0b2d Mon Sep 17 00:00:00 2001 From: John Layt Date: Sat, 15 Feb 2014 16:07:52 +0100 Subject: QRect - Add missing QMargins subtraction operator [ChangeLog][QtCore][QRect] Added QMargins subtraction operator. Change-Id: I64d449e2bae81a34df2cd019cff3fb186f8aaaae Reviewed-by: Lars Knoll Reviewed-by: Friedemann Kleint --- src/corelib/tools/qrect.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/corelib/tools/qrect.h') diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h index 52f1a79362..5f59bde269 100644 --- a/src/corelib/tools/qrect.h +++ b/src/corelib/tools/qrect.h @@ -463,6 +463,12 @@ Q_DECL_CONSTEXPR inline QRect operator+(const QMargins &margins, const QRect &re QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom())); } +Q_DECL_CONSTEXPR inline QRect operator-(const QRect &lhs, const QMargins &rhs) +{ + return QRect(QPoint(lhs.left() + rhs.left(), lhs.top() + rhs.top()), + QPoint(lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom())); +} + Q_DECL_CONSTEXPR inline QRect QRect::marginsAdded(const QMargins &margins) const { return QRect(QPoint(x1 - margins.left(), y1 - margins.top()), -- cgit v1.2.3