diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-11-02 22:05:58 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-13 18:18:48 +0000 |
commit | 8ce34c2e8163cff56048acc761d1337889e09c6f (patch) | |
tree | 4612b0f8c1e2e7df7bc82eef7343eb3e45891799 /src/corelib/tools/qrect.cpp | |
parent | afc7da09ec01b1658451d36c52f22c0d203f593d (diff) |
QRect(F): add transposed()
I didn't add a transpose(), because r = r.transposed() is
perfectly capable of filling that role, and just as
efficient. Existing API mistakes are no excuse to create
more of them.
[ChangeLog][QtCore][QRect/QRectF] Added transposed().
Change-Id: Ic38721e9028496fc9b50f4d4cef2e7a60532eed8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib/tools/qrect.cpp')
-rw-r--r-- | src/corelib/tools/qrect.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index 6215c534f8..4b6183646b 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -706,6 +706,20 @@ QRect QRect::normalized() const Q_DECL_NOTHROW current position. */ +/*! + \fn QRect QRect::transposed() const + \since 5.7 + + Returns a copy of the rectangle that has its width and height + exchanged: + + \code + QRect r = {15, 51, 42, 24}; + r = r.transposed(); // r == {15, 51, 24, 42} + \endcode + + \sa QSize::transposed() +*/ /*! \fn void QRect::setRect(int x, int y, int width, int height) @@ -1842,6 +1856,20 @@ QRectF QRectF::normalized() const Q_DECL_NOTHROW current position. */ +/*! + \fn QRectF QRectF::transposed() const + \since 5.7 + + Returns a copy of the rectangle that has its width and height + exchanged: + + \code + QRectF r = {1.5, 5.1, 4.2, 2.4}; + r = r.transposed(); // r == {1.5, 5.1, 2.4, 4.2} + \endcode + + \sa QSizeF::transposed() +*/ /*! \fn void QRectF::setRect(qreal x, qreal y, qreal width, qreal height) |