diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-16 06:13:32 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-16 06:13:32 (GMT) |
commit | 5d261870c2c208027fd4fd90d66b2e734235ba3d (patch) | |
tree | 5c7f81e7d8dc7a0f8158ab19d6fb2539d01e9d6a /src/declarative/qml/qmlobjectscriptclass.cpp | |
parent | 8eec0b69e303d10582d04784a0bb200418272c4d (diff) | |
download | Qt-5d261870c2c208027fd4fd90d66b2e734235ba3d.zip Qt-5d261870c2c208027fd4fd90d66b2e734235ba3d.tar.gz Qt-5d261870c2c208027fd4fd90d66b2e734235ba3d.tar.bz2 |
Add binding assignment warnings
Diffstat (limited to 'src/declarative/qml/qmlobjectscriptclass.cpp')
-rw-r--r-- | src/declarative/qml/qmlobjectscriptclass.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index c356a3f..a6edd3b 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -52,8 +52,9 @@ QT_BEGIN_NAMESPACE struct ObjectData : public QScriptDeclarativeClass::Object { - ObjectData(QObject *o) : object(o) {} + ObjectData(QObject *o, int t) : object(o), type(t) {} QGuard<QObject> object; + int type; }; /* @@ -77,22 +78,22 @@ QmlObjectScriptClass::~QmlObjectScriptClass() { } -QScriptValue QmlObjectScriptClass::newQObject(QObject *object) +QScriptValue QmlObjectScriptClass::newQObject(QObject *object, int type) { QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); if (!object) - return newObject(scriptEngine, this, new ObjectData(object)); + return newObject(scriptEngine, this, new ObjectData(object, type)); QmlDeclarativeData *ddata = QmlDeclarativeData::get(object, true); if (!ddata->scriptValue.isValid()) { - ddata->scriptValue = newObject(scriptEngine, this, new ObjectData(object)); + ddata->scriptValue = newObject(scriptEngine, this, new ObjectData(object, type)); return ddata->scriptValue; } else if (ddata->scriptValue.engine() == QmlEnginePrivate::getScriptEngine(engine)) { return ddata->scriptValue; } else { - return newObject(scriptEngine, this, new ObjectData(object)); + return newObject(scriptEngine, this, new ObjectData(object, type)); } } @@ -101,6 +102,15 @@ QObject *QmlObjectScriptClass::toQObject(const QScriptValue &value) const return value.toQObject(); } +int QmlObjectScriptClass::objectType(const QScriptValue &value) const +{ + if (scriptClass(value) != this) + return QVariant::Invalid; + + Object *o = object(value); + return ((ObjectData*)(o))->type; +} + QScriptClass::QueryFlags QmlObjectScriptClass::queryProperty(Object *object, const Identifier &name, QScriptClass::QueryFlags flags) @@ -224,7 +234,8 @@ QScriptValue QmlObjectScriptClass::property(QObject *obj, const Identifier &name QObject *rv = 0; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return newQObject(rv); + + return newQObject(rv, lastData->propType); } else { QVariant var = obj->metaObject()->property(lastData->coreIndex).read(obj); return enginePriv->scriptValueFromVariant(var); |