summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qeasingcurve.cpp7
-rw-r--r--src/corelib/tools/qeasingcurve.h3
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp7
3 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 5731faa69c..6f8572cfbf 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -1116,6 +1116,13 @@ QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other)
}
/*!
+ \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
equal. It will also compare the properties of a curve.
*/
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index a5a707102b..8b2e783bdc 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -83,6 +83,9 @@ public:
~QEasingCurve();
QEasingCurve &operator=(const QEasingCurve &other);
+
+ inline void swap(QEasingCurve &other) { qSwap(d_ptr, other.d_ptr); }
+
bool operator==(const QEasingCurve &other) const;
inline bool operator!=(const QEasingCurve &other) const
{ return !(this->operator==(other)); }
diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
index 0a006ab5b4..d5d7ddeb1d 100644
--- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
@@ -445,6 +445,13 @@ void tst_QEasingCurve::setCustomType()
void tst_QEasingCurve::operators()
{
+ { // member-swap()
+ QEasingCurve ec1, ec2;
+ ec2.setCustomType(&discreteEase);
+ ec1.swap(ec2);
+ QCOMPARE(ec1.type(), QEasingCurve::Custom);
+ }
+
// operator=
QEasingCurve curve;
QEasingCurve curve2;