diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2012-12-10 16:53:16 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-07 16:11:19 +0100 |
commit | bc5a2336ab9a681411a81a53d8639b4b79f80073 (patch) | |
tree | 17961ae7f53f8f96c567f4b3cde2f4bbf774e5f2 /src/corelib/tools/qmargins.cpp | |
parent | 6ecc3e76e822b1545bcbfa78f5caf94156a026d2 (diff) |
Provide operators for QMargins.
Provide addition/subtraction for QMargins as well as
multiplication and division for int/qreal similar
to QPoint. Add unary minus.
Change-Id: If4eb831cfd610b34b5ca361619b1636031811d0a
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'src/corelib/tools/qmargins.cpp')
-rw-r--r-- | src/corelib/tools/qmargins.cpp | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index 214466194a..e30675dc63 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -216,6 +216,181 @@ QT_BEGIN_NAMESPACE \since 5.1 */ +/*! + \fn const QMargins operator+(const QMargins &m1, const QMargins &m2) + \relates QMargins + + Returns a QMargins object that is the sum of the given margins, \a m1 + and \a m2; each component is added separately. + + \sa QMargins::operator+=(), QMargins::operator-=() + + \since 5.1 +*/ + +/*! + \fn const QMargins operator-(const QMargins &m1, const QMargins &m2) + \relates QMargins + + Returns a QMargins object that is formed by subtracting \a m2 from + \a m1; each component is subtracted separately. + + \sa QMargins::operator+=(), QMargins::operator-=() + + \since 5.1 +*/ + +/*! + \fn const QMargins operator*(const QMargins &margins, int factor) + \relates QMargins + + Returns a QMargins object that is formed by multiplying each component + of the given \a margins by \a factor. + + \sa QMargins::operator*=(), QMargins::operator/=() + + \since 5.1 +*/ + +/*! + \fn const QMargins operator*(int factor, const QMargins &margins) + \relates QMargins + \overload + + Returns a QMargins object that is formed by multiplying each component + of the given \a margins by \a factor. + + \sa QMargins::operator*=(), QMargins::operator/=() + + \since 5.1 +*/ + +/*! + \fn const QMargins operator*(const QMargins &margins, qreal factor) + \relates QMargins + \overload + + Returns a QMargins object that is formed by multiplying each component + of the given \a margins by \a factor. + + \sa QMargins::operator*=(), QMargins::operator/=() + + \since 5.1 +*/ + +/*! + \fn const QMargins operator*(qreal factor, const QMargins &margins) + \relates QMargins + \overload + + Returns a QMargins object that is formed by multiplying each component + of the given \a margins by \a factor. + + \sa QMargins::operator*=(), QMargins::operator/=() + + \since 5.1 +*/ + +/*! + \fn const QMargins operator/(const QMargins &margins, int divisor) + \relates QMargins + + Returns a QMargins object that is formed by dividing the components of + the given \a margins by the given \a divisor. + + \sa QMargins::operator*=(), QMargins::operator/=() + + \since 5.1 +*/ + +/*! + \fn const QMargins operator/(const QMargins &, qreal) + \relates QMargins + \overload + + Returns a QMargins object that is formed by dividing the components of + the given \a margins by the given \a divisor. + + \sa QMargins::operator*=(), QMargins::operator/=() + + \since 5.1 +*/ + +/*! + \fn QMargins operator-(const QMargins &margins) + \relates QMargins + + Returns a QMargin object that is formed by negating all components of \a margins. + + \since 5.1 +*/ + +/*! + \fn QMargins &operator+=(const QMargins &margins) + + Add each component of \a margins to the respective component of this object + and returns a reference to it. + + \sa operator-=() + + \since 5.1 +*/ + +/*! + \fn QMargins &operator-=(const QMargins &margins) + + Subtract each component of \a margins from the respective component of this object + and returns a reference to it. + + \sa operator+=() + + \since 5.1 +*/ + +/*! + \fn QMargins &operator*=(int factor) + + Multiplies each component of this object by \a factor + and returns a reference to it. + + \sa operator/=() + + \since 5.1 +*/ + +/*! + \fn QMargins &operator*=(qreal factor) + \overload + + Multiplies each component of this object by \a factor + and returns a reference to it. + + \sa operator/=() + + \since 5.1 +*/ + +/*! + \fn QMargins &operator/=(int divisor) + + Divides each component of this object by \a divisor + and returns a reference to it. + + \sa operator*=() + + \since 5.1 +*/ + +/*! + \fn QMargins &operator/=(qreal divisor) + + \overload + + \sa operator*=() + + \since 5.1 +*/ + /***************************************************************************** QMargins stream functions *****************************************************************************/ |