diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-08 03:24:44 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-08 03:24:44 (GMT) |
commit | e7cf5fc921c00286846ac552b51a37fe2f51ff3e (patch) | |
tree | af7c5cade70dfd740b11434a1a5cd7f3ff53ed35 /src/declarative/qml/qdeclarativeobjectscriptclass.cpp | |
parent | 03f8f1df0d88f5ffe0b3120cffce614cbeefdb70 (diff) | |
parent | 3ad6f3b1f4d2252e2a004acc8156a1fd308265cf (diff) | |
download | Qt-e7cf5fc921c00286846ac552b51a37fe2f51ff3e.zip Qt-e7cf5fc921c00286846ac552b51a37fe2f51ff3e.tar.gz Qt-e7cf5fc921c00286846ac552b51a37fe2f51ff3e.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (131 commits)
Avoid many unnecessary allocations, so so that paint engines attached to pixmaps
Doc
Fix autotests
Fix autotests (remove import Qt.widgets)
Add missing qml file to qdeclarativemousearea
Doc fix
Clean up example code, add white background behind text
Update mouse area qmlvisual test to follow change QTBUG-10162
Fix autotest bug in MouseArea
Avoid emitting release when the mouse is ungrabbed
Resize qmlruntime window to new dimensions when orientation changes
Compile with opengl enabled.
Avoid repeated create/destroy at top list boundary with sub-pixel movement.
Call QDeclarativeItem::geometryChanged() base implementation
qdoc fixes.
Avoid warnings as delegates with bindings to parent are created and destroyed.
qdoc fixes
TextInput echoMode doc.
Make sure to call base class implementation.
More cleanup
...
Diffstat (limited to 'src/declarative/qml/qdeclarativeobjectscriptclass.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index bb5c8b7..8b64e0e 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -104,7 +104,8 @@ QScriptValue QDeclarativeObjectScriptClass::newQObject(QObject *object, int type QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); if (!object) - return newObject(scriptEngine, this, new ObjectData(object, type)); + return scriptEngine->nullValue(); +// return newObject(scriptEngine, this, new ObjectData(object, type)); if (QObjectPrivate::get(object)->wasDeleted) return scriptEngine->undefinedValue(); @@ -265,7 +266,7 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); return Value(scriptEngine, rv); - } else if (lastData->propType == QMetaType::Int) { + } else if (lastData->propType == QMetaType::Int || lastData->flags & QDeclarativePropertyCache::Data::IsEnumType) { int rv = 0; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); @@ -368,6 +369,9 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, QString error = QLatin1String("Cannot assign [undefined] to ") + QLatin1String(QMetaType::typeName(lastData->propType)); context->throwError(error); + } else if (!value.isRegExp() && value.isFunction()) { + QString error = QLatin1String("Cannot assign a function to a property."); + context->throwError(error); } else { QVariant v; if (lastData->flags & QDeclarativePropertyCache::Data::IsQList) @@ -441,7 +445,7 @@ QScriptValue QDeclarativeObjectScriptClass::destroy(QScriptContext *context, QSc QDeclarativeData *ddata = QDeclarativeData::get(data->object, false); if (!ddata || ddata->indestructible) - return engine->currentContext()->throwError(QLatin1String("Invalid attempt to destroy() an indestructible object")); + return engine->currentContext()->throwError(QLatin1String("Invalid attempt to destroy() an indestructible object")); QObject *obj = data->object; int delay = 0; @@ -772,7 +776,8 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e) return QScriptDeclarativeClass::Value(engine, *((QString *)&data)); } else if (type == QMetaType::QObjectStar) { QObject *object = *((QObject **)&data); - QDeclarativeData::get(object, true)->setImplicitDestructible(); + if (object) + QDeclarativeData::get(object, true)->setImplicitDestructible(); QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(e); return QScriptDeclarativeClass::Value(engine, priv->objectClass->newQObject(object)); } else if (type == qMetaTypeId<QList<QObject *> >()) { |