diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-11 09:44:26 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-11 09:45:36 (GMT) |
commit | 92789fabd6728820b244d23d7477f2a224a33f94 (patch) | |
tree | f72da55d7eb7c2a024d3b54de93ed920e8868ffb /src/corelib | |
parent | 26da6385e1d687cc9aef375cc9b5fb4f6fc353d0 (diff) | |
download | Qt-92789fabd6728820b244d23d7477f2a224a33f94.zip Qt-92789fabd6728820b244d23d7477f2a224a33f94.tar.gz Qt-92789fabd6728820b244d23d7477f2a224a33f94.tar.bz2 |
small optimization for variant handling in animations
Just one test less
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/animation/qpropertyanimation.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 861bd9f..b64d7df 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -106,13 +106,19 @@ void QPropertyAnimationPrivate::updateMetaProperty() return; } + //propertyType will be set to a valid type only if there is a Q_PROPERTY + //otherwise it will be set to QVariant::Invalid at the end of this function propertyType = targetValue->property(propertyName).userType(); propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName); - if (propertyIndex == -1 && !targetValue->dynamicPropertyNames().contains(propertyName)) - qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData()); if (propertyType != QVariant::Invalid) convertValues(propertyType); + if (propertyIndex == -1) { + //there is no Q_PROPERTY on the object + propertyType = QVariant::Invalid; + if (!targetValue->dynamicPropertyNames().contains(propertyName)) + qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData()); + } } void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue) @@ -125,7 +131,7 @@ void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue) return; } - if (propertyIndex != -1 && newValue.userType() == propertyType) { + if (newValue.userType() == propertyType) { //no conversion is needed, we directly call the QObject::qt_metacall void *data = const_cast<void*>(newValue.constData()); targetValue->qt_metacall(QMetaObject::WriteProperty, propertyIndex, &data); |