QEasingCurve: add member-swap

Implementated as in QPen etc.

Change-Id: Ia08551bf7902b60e115d1b1d2353030597e34841
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2012-02-18 08:52:13 +01:00 committed by Qt by Nokia
parent 689311a568
commit 5d6b2d5e34
3 changed files with 17 additions and 0 deletions

View File

@ -1115,6 +1115,13 @@ QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other)
return *this; return *this;
} }
/*!
\fn void QEasingCurve::swap(QEasingCurve &other)
\since 5.0
Swaps curve \a other with this curve. This operation is very
fast and never fails.
/*! /*!
Compare this easing curve with \a other and returns true if they are Compare this easing curve with \a other and returns true if they are
equal. It will also compare the properties of a curve. equal. It will also compare the properties of a curve.

View File

@ -83,6 +83,9 @@ public:
~QEasingCurve(); ~QEasingCurve();
QEasingCurve &operator=(const QEasingCurve &other); QEasingCurve &operator=(const QEasingCurve &other);
inline void swap(QEasingCurve &other) { qSwap(d_ptr, other.d_ptr); }
bool operator==(const QEasingCurve &other) const; bool operator==(const QEasingCurve &other) const;
inline bool operator!=(const QEasingCurve &other) const inline bool operator!=(const QEasingCurve &other) const
{ return !(this->operator==(other)); } { return !(this->operator==(other)); }

View File

@ -445,6 +445,13 @@ void tst_QEasingCurve::setCustomType()
void tst_QEasingCurve::operators() void tst_QEasingCurve::operators()
{ {
{ // member-swap()
QEasingCurve ec1, ec2;
ec2.setCustomType(&discreteEase);
ec1.swap(ec2);
QCOMPARE(ec1.type(), QEasingCurve::Custom);
}
// operator= // operator=
QEasingCurve curve; QEasingCurve curve;
QEasingCurve curve2; QEasingCurve curve2;