summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
diff options
context:
space:
mode:
authorDebao Zhang <dbzhang800@gmail.com>2012-04-29 00:11:28 -0700
committerQt by Nokia <qt-info@nokia.com>2012-05-02 08:30:59 +0200
commitade888860334d207f5f070b0bc9c4c98deaf3862 (patch)
tree133a3bde54e8ef5fa8857814a45cc5000ee5b287 /tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
parent6102ab8d646d76a68bb460885394501e90b4fd1f (diff)
Don't use obsolete qVariantValue, qVariantCanConvert, etc.
qVariantValue and qVariantCanConvert are Compatibility members, while in Qt4.8 they are marked as Qt 3 Support Members. qVariantFromValue and qVariantSetValue are Obsolete members. Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp')
-rw-r--r--tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
index 05d1569988..11b95d82d8 100644
--- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -702,7 +702,7 @@ Q_DECLARE_METATYPE(QAbstractAnimation::State)
QVariant numberInterpolator(const Number &f, const Number &t, qreal progress)
{
- return qVariantFromValue<Number>(Number(f.n + (t.n - f.n)*progress));
+ return QVariant::fromValue<Number>(Number(f.n + (t.n - f.n)*progress));
}
QVariant xaxisQPointInterpolator(const QPointF &f, const QPointF &t, qreal progress)
@@ -714,21 +714,21 @@ void tst_QPropertyAnimation::interpolated()
{
QObject o;
o.setProperty("point", QPointF()); //this will avoid warnings
- o.setProperty("number", qVariantFromValue<Number>(Number(42)));
- QCOMPARE(qVariantValue<Number>(o.property("number")), Number(42));
+ o.setProperty("number", QVariant::fromValue<Number>(Number(42)));
+ QCOMPARE(qvariant_cast<Number>(o.property("number")), Number(42));
{
qRegisterAnimationInterpolator<Number>(numberInterpolator);
QPropertyAnimation anim(&o, "number");
- anim.setStartValue(qVariantFromValue<Number>(Number(0)));
- anim.setEndValue(qVariantFromValue<Number>(Number(100)));
+ anim.setStartValue(QVariant::fromValue<Number>(Number(0)));
+ anim.setEndValue(QVariant::fromValue<Number>(Number(100)));
anim.setDuration(1000);
anim.start();
anim.pause();
anim.setCurrentTime(100);
- Number t(qVariantValue<Number>(o.property("number")));
+ Number t(qvariant_cast<Number>(o.property("number")));
QCOMPARE(t, Number(10));
anim.setCurrentTime(500);
- QCOMPARE(qVariantValue<Number>(o.property("number")), Number(50));
+ QCOMPARE(qvariant_cast<Number>(o.property("number")), Number(50));
}
{
qRegisterAnimationInterpolator<QPointF>(xaxisQPointInterpolator);
@@ -861,16 +861,16 @@ void tst_QPropertyAnimation::zeroDurationStart()
//let's check the first state change
const QVariantList firstChange = spy.first();
//old state
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.last()), QAbstractAnimation::Stopped);
+ QCOMPARE(qvariant_cast<QAbstractAnimation::State>(firstChange.last()), QAbstractAnimation::Stopped);
//new state
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.first()), QAbstractAnimation::Running);
+ QCOMPARE(qvariant_cast<QAbstractAnimation::State>(firstChange.first()), QAbstractAnimation::Running);
//let's check the first state change
const QVariantList secondChange = spy.last();
//old state
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.last()), QAbstractAnimation::Running);
+ QCOMPARE(qvariant_cast<QAbstractAnimation::State>(secondChange.last()), QAbstractAnimation::Running);
//new state
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.first()), QAbstractAnimation::Stopped);
+ QCOMPARE(qvariant_cast<QAbstractAnimation::State>(secondChange.first()), QAbstractAnimation::Stopped);
}
#define Pause 1