diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-10-12 22:43:14 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-10-12 22:43:14 (GMT) |
commit | 199845126df4b4ab0b8bf329bb104a7e3b2404bf (patch) | |
tree | 5e3768002f2ff668a515404f6ecfe7c9a13bb87d /src/declarative/qml | |
parent | 231604bc063c002240479b69baa8110c2c83e9e1 (diff) | |
parent | 65dfb60a64d31baa555e6c52ccf3aad4309a9db3 (diff) | |
download | Qt-199845126df4b4ab0b8bf329bb104a7e3b2404bf.zip Qt-199845126df4b4ab0b8bf329bb104a7e3b2404bf.tar.gz Qt-199845126df4b4ab0b8bf329bb104a7e3b2404bf.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/parser/qmljslexer.cpp | 11 | ||||
-rw-r--r-- | src/declarative/qml/qmlbasicscript.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompileddata.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 44 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler_p.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompositetypemanager.cpp | 8 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 14 | ||||
-rw-r--r-- | src/declarative/qml/qmlenginedebug.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlinfo.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlintegercache.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 29 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetaproperty_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlobjectscriptclass.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlpropertycache.cpp | 10 | ||||
-rw-r--r-- | src/declarative/qml/qmlscriptparser.cpp | 6 | ||||
-rw-r--r-- | src/declarative/qml/qmlvme.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlxmlhttprequest.cpp | 6 |
18 files changed, 89 insertions, 64 deletions
diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp index f71b92f..54f8d78 100644 --- a/src/declarative/qml/parser/qmljslexer.cpp +++ b/src/declarative/qml/parser/qmljslexer.cpp @@ -867,11 +867,16 @@ bool Lexer::isLineTerminator() const bool Lexer::isIdentLetter(ushort c) { - /* TODO: allow other legitimate unicode chars */ - return ((c >= 'a' && c <= 'z') + // ASCII-biased, since all reserved words are ASCII, aand hence the + // bulk of content to be parsed. + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '$' - || c == '_'); + || c == '_') + return true; + if (c < 128) + return false; + return QChar(c).isLetterOrNumber(); } bool Lexer::isDecimalDigit(ushort c) diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index f8ef2e7..a0d749f 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -369,7 +369,7 @@ bool QmlBasicScript::compile(const Expression &expression) { if (!expression.expression.asAST()) return false; - QByteArray expr = expression.expression.asScript().toLatin1(); + QByteArray expr = expression.expression.asScript().toUtf8(); const char *src = expr.constData(); QmlBasicScriptCompiler bsc; diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp index 8c3c355..7032a3b 100644 --- a/src/declarative/qml/qmlcompileddata.cpp +++ b/src/declarative/qml/qmlcompileddata.cpp @@ -150,7 +150,7 @@ int QmlCompiledData::indexForLocation(const QmlParser::LocationSpan &l) } QmlCompiledData::QmlCompiledData() -: importCache(0) +: importCache(0), root(0) { } @@ -189,7 +189,7 @@ const QMetaObject *QmlCompiledData::TypeReference::metaObject() const return type->metaObject(); } else { Q_ASSERT(component); - return &static_cast<QmlComponentPrivate *>(QObjectPrivate::get(component))->cc->root; + return static_cast<QmlComponentPrivate *>(QObjectPrivate::get(component))->cc->root; } } diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index f33731c..431f9f6 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -195,14 +195,14 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, QString string = v->value.asScript(); if (!prop.isWritable()) - COMPILE_EXCEPTION(v, "Invalid property assignment:" << QLatin1String(prop.name()) << "is a read-only property"); + COMPILE_EXCEPTION(v, "Invalid property assignment:" << QString::fromUtf8(prop.name()) << "is a read-only property"); if (prop.isEnumType()) { int value; if (prop.isFlagType()) { - value = prop.enumerator().keysToValue(string.toLatin1().constData()); + value = prop.enumerator().keysToValue(string.toUtf8().constData()); } else - value = prop.enumerator().keyToValue(string.toLatin1().constData()); + value = prop.enumerator().keyToValue(string.toUtf8().constData()); if (value == -1) COMPILE_EXCEPTION(v, "Invalid property assignment: unknown enumeration"); return true; @@ -336,9 +336,9 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop, if (prop.isEnumType()) { int value; if (prop.isFlagType()) { - value = prop.enumerator().keysToValue(string.toLatin1().constData()); + value = prop.enumerator().keysToValue(string.toUtf8().constData()); } else - value = prop.enumerator().keyToValue(string.toLatin1().constData()); + value = prop.enumerator().keyToValue(string.toUtf8().constData()); instr.type = QmlInstruction::StoreInteger; instr.storeInteger.propertyIndex = prop.propertyIndex(); @@ -595,7 +595,7 @@ bool QmlCompiler::compile(QmlEngine *engine, ref.ref = tref.unit; ref.ref->addref(); } - ref.className = parserRef->name.toLatin1(); + ref.className = parserRef->name.toUtf8(); out->types << ref; } @@ -647,7 +647,13 @@ void QmlCompiler::compileTree(Object *tree) output->importCache = output->imports.cache(engine); Q_ASSERT(tree->metatype); - static_cast<QMetaObject &>(output->root) = *tree->metaObject(); + + if (tree->metadata.isEmpty()) { + output->root = tree->metatype; + } else { + static_cast<QMetaObject &>(output->rootData) = *tree->metaObject(); + output->root = &output->rootData; + } if (!tree->metadata.isEmpty()) QmlEnginePrivate::get(engine)->registerCompositeType(output); } @@ -666,7 +672,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt) obj->className = tr.className; // This object is a "Component" element - if (obj->metatype == &QmlComponent::staticMetaObject) { + if (tr.type && obj->metatype == &QmlComponent::staticMetaObject) { COMPILE_CHECK(buildComponent(obj, ctxt)); return true; } @@ -780,7 +786,9 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt) void QmlCompiler::genObject(QmlParser::Object *obj) { - if (obj->metatype == &QmlComponent::staticMetaObject) { + const QmlCompiledData::TypeReference &tr = + output->types.at(obj->type); + if (tr.type && obj->metatype == &QmlComponent::staticMetaObject) { genComponent(obj); return; } @@ -809,7 +817,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj) if (!obj->metadata.isEmpty()) { QmlInstruction meta; meta.type = QmlInstruction::StoreMetaObject; - meta.line = -1; + meta.line = 0; meta.storeMeta.data = output->indexForByteArray(obj->metadata); meta.storeMeta.aliasData = output->indexForByteArray(obj->synthdata); meta.storeMeta.propertyCache = output->propertyCaches.count(); @@ -822,7 +830,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj) if (!obj->id.isEmpty()) { QmlInstruction id; id.type = QmlInstruction::SetId; - id.line = -1; + id.line = 0; id.setId.value = output->indexForString(obj->id); id.setId.index = obj->idIndex; output->bytecode << id; @@ -832,7 +840,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj) for (int ii = 0; ii < obj->scriptBlocks.count(); ++ii) { QmlInstruction script; script.type = QmlInstruction::StoreScript; - script.line = -1; // ### + script.line = 0; // ### script.storeScript.fileName = output->indexForString(obj->scriptBlocksFile.at(ii)); script.storeScript.lineNumber = obj->scriptBlocksLineNumber.at(ii); script.storeScript.value = output->indexForString(obj->scriptBlocks.at(ii)); @@ -999,7 +1007,7 @@ void QmlCompiler::genComponent(QmlParser::Object *obj) if (!obj->id.isEmpty()) { QmlInstruction id; id.type = QmlInstruction::SetId; - id.line = -1; + id.line = 0; id.setId.value = output->indexForString(obj->id); id.setId.index = obj->idIndex; output->bytecode << id; @@ -1905,7 +1913,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop, if (propertyMetaObject) { const QMetaObject *c = v->object->metatype; while(c) { - isAssignable |= (c == propertyMetaObject); + isAssignable |= (QmlMetaPropertyPrivate::equal(c, propertyMetaObject)); c = c->superClass(); } } @@ -2101,7 +2109,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode) Q_ASSERT(tdata->status == QmlCompositeTypeData::Complete); QmlCompiledData *data = tdata->toCompiledComponent(engine); - customTypeName = data->root.className(); + customTypeName = data->root->className(); } else { customTypeName = qmltype->typeName(); } @@ -2473,7 +2481,7 @@ bool QmlCompiler::canCoerce(int to, QmlParser::Object *from) const QMetaObject *fromMo = from->metaObject(); while (fromMo) { - if (fromMo == toMo) + if (QmlMetaPropertyPrivate::equal(fromMo, toMo)) return true; fromMo = fromMo->superClass(); } @@ -2492,7 +2500,7 @@ bool QmlCompiler::canCoerce(int to, int from) QmlEnginePrivate::get(engine)->rawMetaObjectForType(from); while (fromMo) { - if (fromMo == toMo) + if (QmlMetaPropertyPrivate::equal(fromMo, toMo)) return true; fromMo = fromMo->superClass(); } @@ -2520,7 +2528,7 @@ QStringList QmlCompiler::deferredProperties(QmlParser::Object *obj) return QStringList(); QMetaClassInfo classInfo = mo->classInfo(idx); - QStringList rv = QString(QLatin1String(classInfo.value())).split(QLatin1Char(',')); + QStringList rv = QString::fromUtf8(classInfo.value()).split(QLatin1Char(',')); return rv; } diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 3a35d58..ecf3344 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -104,7 +104,8 @@ public: int type; }; - QAbstractDynamicMetaObject root; + const QMetaObject *root; + QAbstractDynamicMetaObject rootData; QList<QString> primitives; QList<float> floatData; QList<int> intData; diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index 71b4ef0..13bd02c 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -119,7 +119,7 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine) compiledComponent = new QmlCompiledData; compiledComponent->url = imports.baseUrl(); - compiledComponent->name = compiledComponent->url.toString().toLatin1(); // ### + compiledComponent->name = compiledComponent->url.toString().toUtf8(); QmlCompiler compiler; if (!compiler.compile(engine, this, compiledComponent)) { @@ -443,7 +443,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) int waiting = 0; for (int ii = 0; ii < types.count(); ++ii) { QmlScriptParser::TypeReference *parserRef = types.at(ii); - QByteArray typeName = parserRef->name.toLatin1(); + QByteArray typeName = parserRef->name.toUtf8(); QmlCompositeTypeData::TypeReference ref; @@ -458,7 +458,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) if (typeNamespace) { QmlError error; error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Namespace %1 cannot be used as a type").arg(QLatin1String(typeName))); + error.setDescription(tr("Namespace %1 cannot be used as a type").arg(QString::fromUtf8(typeName))); if (!parserRef->refObjects.isEmpty()) { QmlParser::Object *obj = parserRef->refObjects.first(); error.setLine(obj->location.start.line); @@ -500,7 +500,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) { QmlError error; error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Type %1 unavailable").arg(QLatin1String(typeName))); + error.setDescription(tr("Type %1 unavailable").arg(QString::fromUtf8(typeName))); if (!parserRef->refObjects.isEmpty()) { QmlParser::Object *obj = parserRef->refObjects.first(); error.setLine(obj->location.start.line); diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index ccdf6cf..245ddc0 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -970,7 +970,7 @@ struct QmlEnginePrivate::ImportedNamespace { int vmin = minversions.at(i); if (isBuiltin.at(i)) { - QByteArray qt = urls.at(i).toLatin1(); + QByteArray qt = urls.at(i).toUtf8(); qt += "/"; qt += type; QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin); @@ -982,7 +982,7 @@ struct QmlEnginePrivate::ImportedNamespace { return true; } } else { - QUrl url = QUrl(urls.at(i) + QLatin1String("/" + type + ".qml")); + QUrl url = QUrl(urls.at(i) + QLatin1String("/") + QString::fromUtf8(type) + QLatin1String(".qml")); if (vmaj || vmin) { // Check version file - XXX cache these in QmlEngine! QFile qmldir(QUrl(urls.at(i)+QLatin1String("/qmldir")).toLocalFile()); @@ -1101,7 +1101,7 @@ public: if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return)) return true; if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) { - *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QLatin1String(unqualifiedtype + ".qml"))); + *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml"))); return true; } } @@ -1323,7 +1323,7 @@ bool QmlEnginePrivate::addToImport(Imports* imports, const QString& uri, const Q */ bool QmlEnginePrivate::resolveType(const Imports& imports, const QByteArray& type, QmlType** type_return, QUrl* url_return, int *vmaj, int *vmin, ImportedNamespace** ns_return) const { - ImportedNamespace* ns = imports.d->findNamespace(QLatin1String(type)); + ImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type)); if (ns) { if (qmlImportTrace()) qDebug() << "QmlEngine::resolveType" << type << "is namespace for" << ns->urls; @@ -1379,7 +1379,7 @@ static void *voidptr_constructor(const void *v) void QmlEnginePrivate::registerCompositeType(QmlCompiledData *data) { - QByteArray name = data->root.className(); + QByteArray name = data->root->className(); QByteArray ptr = name + "*"; QByteArray lst = "QmlList<" + ptr + ">*"; @@ -1417,7 +1417,7 @@ const QMetaObject *QmlEnginePrivate::rawMetaObjectForType(int t) const { QHash<int, QmlCompiledData*>::ConstIterator iter = m_compositeTypes.find(t); if (iter != m_compositeTypes.end()) { - return &(*iter)->root; + return (*iter)->root; } else { return QmlMetaType::rawMetaObjectForType(t); } @@ -1427,7 +1427,7 @@ const QMetaObject *QmlEnginePrivate::metaObjectForType(int t) const { QHash<int, QmlCompiledData*>::ConstIterator iter = m_compositeTypes.find(t); if (iter != m_compositeTypes.end()) { - return &(*iter)->root; + return (*iter)->root; } else { return QmlMetaType::metaObjectForType(t); } diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp index 16129ee..e20616a 100644 --- a/src/declarative/qml/qmlenginedebug.cpp +++ b/src/declarative/qml/qmlenginedebug.cpp @@ -325,8 +325,8 @@ void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QByteArra QString objectName = o->objectName(); if (objectName.isEmpty()) objectName = QLatin1String("<unnamed>"); - v = QLatin1String(o->metaObject()->className()) + - QLatin1String(": ") + objectName; + v = QString::fromUtf8(o->metaObject()->className()) + + QLatin1String(": ") + objectName; } if (v.isNull()) v = value.toString(); diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 0de64d9..76ca2c1 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -212,7 +212,7 @@ QString QmlExpression::expression() const { Q_D(const QmlExpression); if (d->data->sse.isValid()) - return QLatin1String(d->data->sse.expression()); + return QString::fromUtf8(d->data->sse.expression()); else return d->data->expression; } diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp index bae1682..e3c0225 100644 --- a/src/declarative/qml/qmlinfo.cpp +++ b/src/declarative/qml/qmlinfo.cpp @@ -95,7 +95,7 @@ QmlInfo::QmlInfo(QObject *object) location += QLatin1String(":"); location += QString::number(ddata->columnNumber); location += QLatin1String(")"); - *this << location.toLatin1().constData(); + *this << qPrintable(location); } else { *this << "(unknown location):"; } diff --git a/src/declarative/qml/qmlintegercache.cpp b/src/declarative/qml/qmlintegercache.cpp index 564faaa..89a18a1 100644 --- a/src/declarative/qml/qmlintegercache.cpp +++ b/src/declarative/qml/qmlintegercache.cpp @@ -87,7 +87,7 @@ QmlIntegerCache *QmlIntegerCache::createForEnums(QmlType *type, QmlEngine *engin QMetaEnum enumerator = mo->enumerator(ii); for (int jj = 0; jj < enumerator.keyCount(); ++jj) { - QString name = QLatin1String(enumerator.key(jj)); + QString name = QString::fromUtf8(enumerator.key(jj)); int value = enumerator.value(jj); if (!name.at(0).isUpper()) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 59699ef..86116c7 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -174,7 +174,7 @@ void QmlMetaPropertyPrivate::initProperty(QObject *obj, const QString &name) if (typeData) { QmlType *t = 0; - enginePrivate->resolveType(typeData->imports, name.toLatin1(), &t, 0, 0, 0, 0); + enginePrivate->resolveType(typeData->imports, name.toUtf8(), &t, 0, 0, 0, 0); if (t && t->attachedPropertiesFunction()) { attachedFunc = t->index(); } @@ -467,7 +467,7 @@ QStringList QmlMetaProperty::properties(QObject *obj) const QMetaObject *mo = obj->metaObject(); for (int ii = 0; ii < mo->propertyCount(); ++ii) { QMetaProperty prop = mo->property(ii); - rv << QLatin1String(prop.name()); + rv << QString::fromUtf8(prop.name()); } return rv; @@ -487,7 +487,7 @@ QString QmlMetaProperty::name() const else valueType = QmlValueTypeFactory::valueType(d->core.propType); Q_ASSERT(valueType); - rv += QLatin1String(valueType->metaObject()->property(d->valueTypeCoreIdx).name()); + rv += QString::fromUtf8(valueType->metaObject()->property(d->valueTypeCoreIdx).name()); if (!ep) delete valueType; @@ -654,7 +654,7 @@ QMetaMethod QmlMetaPropertyPrivate::findSignal(QObject *obj, const QString &name int methods = mo->methodCount(); for (int ii = methods - 1; ii >= 0; --ii) { QMetaMethod method = mo->method(ii); - QString methodName = QLatin1String(method.signature()); + QString methodName = QString::fromUtf8(method.signature()); int idx = methodName.indexOf(QLatin1Char('(')); methodName = methodName.left(idx); @@ -836,7 +836,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data u = value.toUrl(); found = true; } else if (vt == QVariant::ByteArray) { - u = QUrl(QLatin1String(value.toByteArray())); + u = QUrl(QString::fromUtf8(value.toByteArray())); found = true; } else if (vt == QVariant::String) { u = QUrl(value.toString()); @@ -846,9 +846,9 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data if (found) { if (context && u.isRelative() && !u.isEmpty()) u = context->baseUrl().resolved(u); - void *a[1]; - a[0] = &u; - QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); + int status = -1; + void *argv[] = { &u, 0, &status, &flags }; + QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv); } } else if (vt == t) { @@ -873,7 +873,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data const QMetaObject *propMo = QmlMetaType::rawMetaObjectForType(t); while (valMo) { - if (valMo == propMo) + if (equal(valMo, propMo)) break; valMo = valMo->superClass(); } @@ -927,7 +927,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data const QMetaObject *objMo = obj->metaObject(); bool found = false; while(!found && objMo) { - if (objMo == mo) + if (equal(objMo, mo)) found = true; else objMo = objMo->superClass(); @@ -1210,4 +1210,13 @@ QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, return prop; } +/*! + Returns true if lhs and rhs refer to the same metaobject data +*/ +bool QmlMetaPropertyPrivate::equal(const QMetaObject *lhs, const QMetaObject *rhs) +{ + return lhs == rhs || (1 && lhs && rhs && lhs->d.stringdata == rhs->d.stringdata); +} + + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h index b74aa2d..7288266 100644 --- a/src/declarative/qml/qmlmetaproperty_p.h +++ b/src/declarative/qml/qmlmetaproperty_p.h @@ -106,6 +106,8 @@ public: static quint32 saveValueType(int, int); static quint32 saveProperty(int); + + static bool equal(const QMetaObject *, const QMetaObject *); }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 41573a2..80f2786 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -267,7 +267,7 @@ QScriptValue QmlObjectScriptClass::tostring(QScriptContext *context, QScriptEngi if(obj){ QString objectName = obj->objectName(); - ret += QLatin1String(obj->metaObject()->className()); + ret += QString::fromUtf8(obj->metaObject()->className()); ret += QLatin1String("(0x"); ret += QString::number((quintptr)obj,16); diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 63ce00c..e00126f 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -52,7 +52,7 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p) propType = qMetaTypeId<QVariant>(); coreIndex = p.propertyIndex(); notifyIndex = p.notifySignalIndex(); - name = QLatin1String(p.name()); + name = QString::fromUtf8(p.name()); if (p.isConstant()) flags |= Data::IsConstant; @@ -76,7 +76,7 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p) void QmlPropertyCache::Data::load(const QMetaMethod &m) { - name = QLatin1String(m.signature()); + name = QString::fromUtf8(m.signature()); int parenIdx = name.indexOf(QLatin1Char('(')); Q_ASSERT(parenIdx != -1); name = name.left(parenIdx); @@ -120,7 +120,7 @@ QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject, int methodCount = metaObject->methodCount(); for (int ii = methodCount - 1; ii >= 0; --ii) { QMetaMethod m = metaObject->method(ii); - QString methodName = QLatin1String(m.signature()); + QString methodName = QString::fromUtf8(m.signature()); int parenIdx = methodName.indexOf(QLatin1Char('(')); Q_ASSERT(parenIdx != -1); @@ -151,7 +151,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject cache->indexCache.resize(propCount); for (int ii = propCount - 1; ii >= 0; --ii) { QMetaProperty p = metaObject->property(ii); - QString propName = QLatin1String(p.name()); + QString propName = QString::fromUtf8(p.name()); RData *data = new RData; data->identifier = enginePriv->objectClass->createPersistentIdentifier(propName); @@ -172,7 +172,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject int methodCount = metaObject->methodCount(); for (int ii = methodCount - 1; ii >= 0; --ii) { QMetaMethod m = metaObject->method(ii); - QString methodName = QLatin1String(m.signature()); + QString methodName = QString::fromUtf8(m.signature()); int parenIdx = methodName.indexOf(QLatin1Char('(')); Q_ASSERT(parenIdx != -1); diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 1c7bf83..57e40b6 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -87,12 +87,12 @@ class ProcessAST: protected AST::Visitor const State &state = top(); if (state.property) { State s(state.property->getValue(), - state.property->getValue()->getProperty(name.toLatin1())); + state.property->getValue()->getProperty(name.toUtf8())); s.property->location = location; push(s); } else { State s(state.object, - state.object->getProperty(name.toLatin1())); + state.object->getProperty(name.toUtf8())); s.property->location = location; push(s); @@ -312,7 +312,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, // XXX this doesn't do anything (_scope never builds up) _scope.append(resolvableObjectType); - obj->typeName = qualifiedNameId().toLatin1(); + obj->typeName = qualifiedNameId().toUtf8(); _scope.removeLast(); obj->location = location; diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index d4921b6..675f5ae 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -515,7 +515,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, int sigIdx = instr.assignSignalObject.signal; const QByteArray &pr = datas.at(sigIdx); - QmlMetaProperty prop(target, QLatin1String(pr)); + QmlMetaProperty prop(target, QString::fromUtf8(pr)); if (prop.type() & QmlMetaProperty::SignalProperty) { QMetaMethod method = QmlMetaType::defaultMethod(assign); diff --git a/src/declarative/qml/qmlxmlhttprequest.cpp b/src/declarative/qml/qmlxmlhttprequest.cpp index 0bc927c..5117a00 100644 --- a/src/declarative/qml/qmlxmlhttprequest.cpp +++ b/src/declarative/qml/qmlxmlhttprequest.cpp @@ -1105,7 +1105,7 @@ void QmlXMLHttpRequest::downloadProgress(qint64 bytes) m_status = m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); m_statusText = - QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); + QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); // ### We assume if this is called the headers are now available if (m_state < HeadersReceived) { @@ -1127,7 +1127,7 @@ void QmlXMLHttpRequest::error(QNetworkReply::NetworkError error) m_status = m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); m_statusText = - QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); + QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); m_responseEntityBody = QByteArray(); m_errorFlag = true; @@ -1146,7 +1146,7 @@ void QmlXMLHttpRequest::finished() m_status = m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); m_statusText = - QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); + QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); if (m_state < HeadersReceived) { m_state = HeadersReceived; |