/*! \internal
 * Registers a custom interpolator \a func for the specific \a interpolationType.
 * The interpolator has to be registered before the animation is constructed.
 * To unregister (and use the default interpolator) set \a func to 0.
 */
void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator func, int interpolationType)
{
    // will override any existing interpolators
    QInterpolatorVector *interpolators = registeredInterpolators();
#ifndef QT_NO_THREAD
    QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
#endif
    if (int(interpolationType) >= interpolators->count())
        interpolators->resize(int(interpolationType) + 1);
    interpolators->replace(interpolationType, func);
}
예제 #2
0
/*!
 * \internal
 * Registers a custom interpolator \a func for the specific \a interpolationType.
 * The interpolator has to be registered before the animation is constructed.
 * To unregister (and use the default interpolator) set \a func to 0.
 */
void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator func, int interpolationType)
{
    // will override any existing interpolators
    QInterpolatorVector *interpolators = registeredInterpolators();
    // When built on solaris with GCC, the destructors can be called
    // in such an order that we get here with interpolators == NULL,
    // to continue causes the app to crash on exit with a SEGV
    if (interpolators) {
        QMutexLocker locker(&registeredInterpolatorsMutex);
        if (int(interpolationType) >= interpolators->count())
            interpolators->resize(int(interpolationType) + 1);
        interpolators->replace(interpolationType, func);
    }
}