summaryrefslogtreecommitdiffstats
path: root/examples/script/customclass
diff options
context:
space:
mode:
Diffstat (limited to 'examples/script/customclass')
-rw-r--r--examples/script/customclass/bytearrayclass.cpp6
-rw-r--r--examples/script/customclass/main.cpp2
2 files changed, 5 insertions, 3 deletions
diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp
index 13f70bf..f325398 100644
--- a/examples/script/customclass/bytearrayclass.cpp
+++ b/examples/script/customclass/bytearrayclass.cpp
@@ -88,7 +88,7 @@ ByteArrayClass::ByteArrayClass(QScriptEngine *engine)
proto.setPrototype(global.property("Object").property("prototype"));
ctor = engine->newFunction(construct, proto);
- ctor.setData(qScriptValueFromValue(engine, this));
+ ctor.setData(engine->toScriptValue(this));
}
//! [0]
@@ -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);
}
diff --git a/examples/script/customclass/main.cpp b/examples/script/customclass/main.cpp
index 16e2a9f..054c71c 100644
--- a/examples/script/customclass/main.cpp
+++ b/examples/script/customclass/main.cpp
@@ -38,6 +38,8 @@
**
****************************************************************************/
+#include <QCoreApplication>
+#include <QtDebug>
#include <QtScript>
#include "bytearrayclass.h"