diff options
Diffstat (limited to 'examples/script')
-rw-r--r-- | examples/script/calculator/calculator.pro | 1 | ||||
-rw-r--r-- | examples/script/calculator/main.cpp | 2 | ||||
-rw-r--r-- | examples/script/context2d/context2d.cpp | 4 | ||||
-rw-r--r-- | examples/script/context2d/context2d.pro | 2 | ||||
-rw-r--r-- | examples/script/context2d/domimage.cpp | 2 | ||||
-rw-r--r-- | examples/script/customclass/bytearrayclass.cpp | 6 | ||||
-rw-r--r-- | examples/script/marshal/main.cpp | 2 | ||||
-rw-r--r-- | examples/script/qstetrix/main.cpp | 2 |
8 files changed, 11 insertions, 10 deletions
diff --git a/examples/script/calculator/calculator.pro b/examples/script/calculator/calculator.pro index 6385d7e..f328fc3 100644 --- a/examples/script/calculator/calculator.pro +++ b/examples/script/calculator/calculator.pro @@ -2,6 +2,7 @@ QT += script CONFIG += uitools RESOURCES += calculator.qrc SOURCES += main.cpp +QMAKE_PROJECT_NAME = scripted_calculator contains(QT_CONFIG, scripttools): QT += scripttools diff --git a/examples/script/calculator/main.cpp b/examples/script/calculator/main.cpp index 8030a87..c258a9b 100644 --- a/examples/script/calculator/main.cpp +++ b/examples/script/calculator/main.cpp @@ -89,7 +89,7 @@ int main(int argc, char **argv) //! [2] #if !defined(QT_NO_SCRIPTTOOLS) - QLineEdit *display = qFindChild<QLineEdit*>(ui, "display"); + QLineEdit *display = ui->findChild<QLineEdit*>("display"); QObject::connect(display, SIGNAL(returnPressed()), debugWindow, SLOT(show())); #endif 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/context2d.pro b/examples/script/context2d/context2d.pro index 54f5c31..6a0e397 100644 --- a/examples/script/context2d/context2d.pro +++ b/examples/script/context2d/context2d.pro @@ -27,6 +27,6 @@ symbian:{ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCHEAPSIZE = 0x200000 0xA00000 contextScripts.path = . - contextScripts.sources = scripts + contextScripts.files = scripts DEPLOYMENT += contextScripts } 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..7bf6d3f 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/marshal/main.cpp b/examples/script/marshal/main.cpp index adfeaf1..270cb56 100644 --- a/examples/script/marshal/main.cpp +++ b/examples/script/marshal/main.cpp @@ -49,7 +49,7 @@ QScriptValue toScriptValue(QScriptEngine *eng, const Container &cont) typename Container::const_iterator end = cont.end(); typename Container::const_iterator it; for (it = begin; it != end; ++it) - a.setProperty(quint32(it - begin), qScriptValueFromValue(eng, *it)); + a.setProperty(quint32(it - begin), eng->toScriptValue(*it)); return a; } diff --git a/examples/script/qstetrix/main.cpp b/examples/script/qstetrix/main.cpp index e12e26d..c802584 100644 --- a/examples/script/qstetrix/main.cpp +++ b/examples/script/qstetrix/main.cpp @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) QScriptValue tetrix = ctor.construct(QScriptValueList() << scriptUi); //! [3] - QPushButton *debugButton = qFindChild<QPushButton*>(ui, "debugButton"); + QPushButton *debugButton = ui->findChild<QPushButton*>("debugButton"); #if !defined(QT_NO_SCRIPTTOOLS) QObject::connect(debugButton, SIGNAL(clicked()), debugger.action(QScriptEngineDebugger::InterruptAction), |