summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-07-08 06:38:29 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-07-08 06:38:29 (GMT)
commit4c916bd688bc9e20d75359f12208eb8a33dc6670 (patch)
tree190fb084f69128f6a1a788524cda21079f29cc6a /src/declarative/util
parent239c3581bb84b6484547918fbb1672fed08970dd (diff)
parent46688b1e8b953f9e3a12d42b9aa73a8eba904f5b (diff)
downloadQt-4c916bd688bc9e20d75359f12208eb8a33dc6670.zip
Qt-4c916bd688bc9e20d75359f12208eb8a33dc6670.tar.gz
Qt-4c916bd688bc9e20d75359f12208eb8a33dc6670.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qmlanimation.cpp29
-rw-r--r--src/declarative/util/qmlanimation_p.h2
2 files changed, 18 insertions, 13 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index c0d6481..ff070c1 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -1436,11 +1436,11 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
QML_DEFINE_TYPE(QmlParallelAnimation,ParallelAnimation)
//convert a variant from string type to another animatable type
-//### should use any registered string convertor
-void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, QVariant::Type type)
+void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
{
if (variant.type() != QVariant::String) {
- variant.convert(type);
+ if ((uint)type < QVariant::UserType)
+ variant.convert((QVariant::Type)type);
return;
}
@@ -1474,7 +1474,12 @@ void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, QVariant::Ty
break;
}
default:
- variant.convert(type);
+ if ((uint)type >= QVariant::UserType) {
+ QmlMetaType::StringConverter converter = QmlMetaType::customStringConverter(type);
+ if (converter)
+ variant = converter(variant.toString());
+ } else
+ variant.convert((QVariant::Type)type);
break;
}
}
@@ -1722,7 +1727,7 @@ void QmlPropertyAnimationPrivate::valueChanged(qreal r)
if (!fromSourced) {
if (!fromIsDefined) {
from = property.read();
- convertVariant(from, (QVariant::Type)(interpolatorType ? interpolatorType : property.propertyType()));
+ convertVariant(from, interpolatorType ? interpolatorType : property.propertyType());
//### check for invalid variant if using property type
}
fromSourced = true;
@@ -1751,9 +1756,9 @@ void QmlPropertyAnimation::prepare(QmlMetaProperty &p)
d->property = d->userProperty;
int propType = d->property.propertyType();
- d->convertVariant(d->to, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : propType));
+ d->convertVariant(d->to, d->interpolatorType ? d->interpolatorType : propType);
if (d->fromIsDefined)
- d->convertVariant(d->from, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : propType));
+ d->convertVariant(d->from, d->interpolatorType ? d->interpolatorType : propType);
if (!d->interpolatorType) {
//### check for invalid variants
@@ -1795,7 +1800,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
if (interpolatorType)
- QmlPropertyAnimationPrivate::convertVariant(action.fromValue, (QVariant::Type)interpolatorType);
+ QmlPropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType);
}
if (!interpolatorType) {
int propType = action.property.propertyType();
@@ -1856,8 +1861,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
if (d->toIsDefined)
myAction.toValue = d->to;
- d->convertVariant(myAction.fromValue, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
- d->convertVariant(myAction.toValue, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
+ d->convertVariant(myAction.fromValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
+ d->convertVariant(myAction.toValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
modified << action.property;
@@ -1875,10 +1880,10 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
continue;
if (d->fromIsDefined) {
- d->convertVariant(d->from, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
+ d->convertVariant(d->from, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
myAction.fromValue = d->from;
}
- d->convertVariant(d->to, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
+ d->convertVariant(d->to, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
myAction.toValue = d->to;
data->actions << myAction;
}
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index 00759e1..87d480f 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -346,7 +346,7 @@ public:
QmlTimeLineValueProxy<QmlPropertyAnimationPrivate> value;
static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress);
- static void convertVariant(QVariant &variant, QVariant::Type type);
+ static void convertVariant(QVariant &variant, int type);
};
QT_END_NAMESPACE