diff options
Diffstat (limited to 'src/corelib/tools/qeasingcurve.cpp')
| -rw-r--r-- | src/corelib/tools/qeasingcurve.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 5731faa69c..81778f908f 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -419,6 +419,11 @@ public: config(0), func(&easeNone) { } + QEasingCurvePrivate(const QEasingCurvePrivate &other) + : type(other.type), + config(other.config ? other.config->copy() : 0), + func(other.func) + { } ~QEasingCurvePrivate() { delete config; } void setType_helper(QEasingCurve::Type); @@ -1080,12 +1085,9 @@ QEasingCurve::QEasingCurve(Type type) Construct a copy of \a other. */ QEasingCurve::QEasingCurve(const QEasingCurve &other) - : d_ptr(new QEasingCurvePrivate) + : d_ptr(new QEasingCurvePrivate(*other.d_ptr)) { // ### non-atomic, requires malloc on shallow copy - *d_ptr = *other.d_ptr; - if (other.d_ptr->config) - d_ptr->config = other.d_ptr->config->copy(); } /*! @@ -1098,22 +1100,17 @@ QEasingCurve::~QEasingCurve() } /*! + \fn QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other) Copy \a other. */ -QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other) -{ - // ### non-atomic, requires malloc on shallow copy - if (d_ptr->config) { - delete d_ptr->config; - d_ptr->config = 0; - } - *d_ptr = *other.d_ptr; - if (other.d_ptr->config) - d_ptr->config = other.d_ptr->config->copy(); +/*! + \fn void QEasingCurve::swap(QEasingCurve &other) + \since 5.0 - return *this; -} + 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 |
