diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-04 16:29:09 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-06 09:06:17 (GMT) |
commit | 633f3f45e5420663cf4ceadea79e62fea44cd2eb (patch) | |
tree | 1b2c0d8b5dc0746a51c2ea4bf542845273cf7006 /examples/script | |
parent | 7b5e37cab738804d47b78582aa3d0f3bb6933e70 (diff) | |
download | Qt-633f3f45e5420663cf4ceadea79e62fea44cd2eb.zip Qt-633f3f45e5420663cf4ceadea79e62fea44cd2eb.tar.gz Qt-633f3f45e5420663cf4ceadea79e62fea44cd2eb.tar.bz2 |
Remove the use of deprecated qVariant*
Test directory untouched.
This just apply those regexp:
git grep -O"sed -i 's/qVariantValue</qvariant_cast</'" qVariantValue
git grep -O"sed -i 's/qVariantSetValue(\([^&*\(),]*\), */\\1.setValue(/'" qVariantSetValue
git grep -O"sed -i 's/qVariantSetValue *<\([^>]*\)> *(\([^&*\(),]*\), */\\2.setValue<\\1>(/'" qVariantSetValue
git grep -O"sed -i 's/qVariantCanConvert *<\([^>]*\)> *(\([^&*\(),]*\))/\\2.canConvert<\\1>()/g'" qVariantCanConvert
git grep -O"sed -i 's/qVariantCanConvert *<\([^>]*\)> *(\([^&*\(),]*([^&*\(),]*)\))/\\2.canConvert<\\1>()/g'" qVariantCanConvert
git grep -O"sed -i 's/qVariantFromValue\( *[(<]\)/QVariant::fromValue\\1/'" qVariantFromValue
git checkout src/corelib/kernal/qvariant*
Rev-by: dev mailing list
Diffstat (limited to 'examples/script')
-rw-r--r-- | examples/script/context2d/context2d.cpp | 4 | ||||
-rw-r--r-- | examples/script/context2d/domimage.cpp | 2 | ||||
-rw-r--r-- | examples/script/customclass/bytearrayclass.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/examples/script/context2d/context2d.cpp b/examples/script/context2d/context2d.cpp index c408736..49fc3bc 100644 --- a/examples/script/context2d/context2d.cpp +++ b/examples/script/context2d/context2d.cpp @@ -278,7 +278,7 @@ QVariant Context2D::strokeStyle() const void Context2D::setStrokeStyle(const QVariant &style) { - if (qVariantCanConvert<CanvasGradient>(style)) { + if (style.canConvert<CanvasGradient>()) { CanvasGradient cg = qvariant_cast<CanvasGradient>(style); m_state.strokeStyle = cg.value; } else { @@ -296,7 +296,7 @@ QVariant Context2D::fillStyle() const //! [3] void Context2D::setFillStyle(const QVariant &style) { - if (qVariantCanConvert<CanvasGradient>(style)) { + if (style.canConvert<CanvasGradient>()) { CanvasGradient cg = qvariant_cast<CanvasGradient>(style); m_state.fillStyle = cg.value; } else { diff --git a/examples/script/context2d/domimage.cpp b/examples/script/context2d/domimage.cpp index 801e1a2..f655c6f 100644 --- a/examples/script/context2d/domimage.cpp +++ b/examples/script/context2d/domimage.cpp @@ -84,7 +84,7 @@ static QScriptValue Image(QScriptContext *context, QScriptEngine *env) { QScriptValue val = context->thisObject(); DomImage *image = new DomImage(); - QScriptValue klass = env->newVariant(qVariantFromValue(image)); + QScriptValue klass = env->newVariant(QVariant::fromValue(image)); klass.setPrototype(DomImage::s_self); return klass; } diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp index 5ecee0a..0a1ad2d 100644 --- a/examples/script/customclass/bytearrayclass.cpp +++ b/examples/script/customclass/bytearrayclass.cpp @@ -204,7 +204,7 @@ QScriptValue ByteArrayClass::newInstance(int size) //! [1] QScriptValue ByteArrayClass::newInstance(const QByteArray &ba) { - QScriptValue data = engine()->newVariant(qVariantFromValue(ba)); + QScriptValue data = engine()->newVariant(QVariant::fromValue(ba)); return engine()->newObject(this, data); } //! [1] @@ -228,7 +228,7 @@ QScriptValue ByteArrayClass::toScriptValue(QScriptEngine *eng, const QByteArray QScriptValue ctor = eng->globalObject().property("ByteArray"); ByteArrayClass *cls = qscriptvalue_cast<ByteArrayClass*>(ctor.data()); if (!cls) - return eng->newVariant(qVariantFromValue(ba)); + return eng->newVariant(QVariant::fromValue(ba)); return cls->newInstance(ba); } |