Remove more QByteArray<->QString conversions
authorKent Hansen <kent.hansen@nokia.com>
Thu, 29 Sep 2011 08:29:22 +0000 (10:29 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 29 Sep 2011 12:59:15 +0000 (14:59 +0200)
Prefer to store types as QStrings. It's only when we manipulate
raw (compiled, meta-)data that utf conversion is needed.

Change-Id: Ie138a69c9a409804e1b90b21c1d60dedea35bddb
Reviewed-on: http://codereview.qt-project.org/5781
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
27 files changed:
src/declarative/debugger/qdeclarativeenginedebugservice.cpp
src/declarative/qml/qdeclarativecompiler.cpp
src/declarative/qml/qdeclarativecompiler_p.h
src/declarative/qml/qdeclarativecomponent.cpp
src/declarative/qml/qdeclarativecustomparser.cpp
src/declarative/qml/qdeclarativecustomparser_p.h
src/declarative/qml/qdeclarativecustomparser_p_p.h
src/declarative/qml/qdeclarativedirparser.cpp
src/declarative/qml/qdeclarativedirparser_p.h
src/declarative/qml/qdeclarativeengine.cpp
src/declarative/qml/qdeclarativeexpression_p.h
src/declarative/qml/qdeclarativeinfo.cpp
src/declarative/qml/qdeclarativemetatype.cpp
src/declarative/qml/qdeclarativemetatype_p.h
src/declarative/qml/qdeclarativescript.cpp
src/declarative/qml/qdeclarativescript_p.h
src/declarative/qml/qdeclarativevme.cpp
src/declarative/util/qdeclarativeconnections.cpp
src/declarative/util/qdeclarativelistmodel.cpp
src/declarative/util/qdeclarativelistmodel_p.h
src/declarative/util/qdeclarativepropertychanges.cpp
src/declarative/util/qdeclarativepropertychanges_p.h
src/imports/gestures/qdeclarativegesturearea.cpp
src/qtquick1/util/qdeclarativeconnections.cpp
src/qtquick1/util/qdeclarativepropertychanges.cpp
src/qtquick1/util/qdeclarativepropertychanges_p.h
tools/qmlplugindump/main.cpp

index 9841f87..9ba99af 100644 (file)
@@ -372,7 +372,7 @@ QDeclarativeEngineDebugService::objectData(QObject *object)
 
     QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
     if (type) {
-        QString typeName = QLatin1String(type->qmlTypeName());
+        QString typeName = type->qmlTypeName();
         int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
         rv.objectType = lastSlash < 0 ? typeName : typeName.mid(lastSlash+1);
     } else {
index 8c26a3b..69df595 100644 (file)
@@ -2235,7 +2235,7 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeScript::Pro
             QDeclarativeScript::Object *root = v->object;
             QDeclarativeScript::Object *component = pool->New<Object>();
             component->type = componentTypeRef();
-            component->typeName = "Qt/Component";
+            component->typeName = QStringLiteral("Qt/Component");
             component->metatype = &QDeclarativeComponent::staticMetaObject;
             component->location = root->location;
             QDeclarativeScript::Value *componentValue = pool->New<Value>();
@@ -2294,7 +2294,7 @@ bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeScript::Propert
             buildDynamicMeta(baseObj, ForceCreation);
         v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor;
     } else {
-        COMPILE_EXCEPTION(v, tr("\"%1\" cannot operate on \"%2\"").arg(QString::fromUtf8(v->object->typeName)).arg(prop->name().toString()));
+        COMPILE_EXCEPTION(v, tr("\"%1\" cannot operate on \"%2\"").arg(v->object->typeName).arg(prop->name().toString()));
     }
 
     return true;
@@ -2360,7 +2360,7 @@ bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop
     unit->imports().resolveType(typeName, &type, 0, 0, 0, 0);
 
     //handle enums on value types (where obj->typeName is empty)
-    QByteArray objTypeName = obj->typeName;
+    QString objTypeName = obj->typeName;
     if (objTypeName.isEmpty()) {
         QDeclarativeType *objType = toQmlType(obj);
         if (objType)
@@ -2429,10 +2429,10 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const
     return -1;
 }
 
-const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) const
+const QMetaObject *QDeclarativeCompiler::resolveType(const QString& name) const
 {
     QDeclarativeType *qmltype = 0;
-    if (!unit->imports().resolveType(QString::fromUtf8(name), &qmltype, 0, 0, 0, 0))
+    if (!unit->imports().resolveType(name, &qmltype, 0, 0, 0, 0))
         return 0;
     if (!qmltype)
         return 0;
index 993c733..5e3ad03 100644 (file)
@@ -278,7 +278,7 @@ public:
     static bool isSignalPropertyName(const QHashedStringRef &);
 
     int evaluateEnum(const QByteArray& script) const; // for QDeclarativeCustomParser::evaluateEnum
-    const QMetaObject *resolveType(const QByteArray& name) const; // for QDeclarativeCustomParser::resolveType
+    const QMetaObject *resolveType(const QString& name) const; // for QDeclarativeCustomParser::resolveType
     int rewriteBinding(const QString& expression, const QString& name); // for QDeclarativeCustomParser::rewriteBinding
 
 private:
index 0d390b0..2f1ad82 100644 (file)
@@ -91,16 +91,16 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
     static const QChar underscore(QLatin1Char('_'));
     static const QChar asterisk(QLatin1Char('*'));
     QDeclarativeType *type = QDeclarativeMetaType::qmlType(metaObject);
-    QString typeName = type ? QLatin1String(type->qmlTypeName()) : QLatin1String(metaObject->className());
+    QString typeName = type ? type->qmlTypeName() : QString::fromUtf8(metaObject->className());
     if (!type) {
         //### optimize further?
         int marker = typeName.indexOf(qmlMarker);
         if (marker != -1 && marker < typeName.count() - 1) {
             if (typeName[marker + 1] == underscore) {
                 const QString className = typeName.left(marker) + asterisk;
-                type = QDeclarativeMetaType::qmlType(QMetaType::type(className.toLatin1()));
+                type = QDeclarativeMetaType::qmlType(QMetaType::type(className.toUtf8()));
                 if (type)
-                    typeName = QLatin1String(type->qmlTypeName());
+                    typeName = type->qmlTypeName();
             }
         }
     }
index e806707..4327110 100644 (file)
@@ -114,7 +114,7 @@ QDeclarativeCustomParserProperty
 QDeclarativeCustomParserNodePrivate::fromProperty(QDeclarativeScript::Property *p)
 {
     QDeclarativeCustomParserProperty prop;
-    prop.d->name = p->name().toUtf8();
+    prop.d->name = p->name().toString();
     prop.d->isList = p->values.isMany();
     prop.d->location = p->location.start;
 
@@ -164,7 +164,7 @@ QDeclarativeCustomParserNode::~QDeclarativeCustomParserNode()
     delete d; d = 0;
 }
 
-QByteArray QDeclarativeCustomParserNode::name() const
+QString QDeclarativeCustomParserNode::name() const
 {
     return d->name;
 }
@@ -204,7 +204,7 @@ QDeclarativeCustomParserProperty::~QDeclarativeCustomParserProperty()
     delete d; d = 0;
 }
 
-QByteArray QDeclarativeCustomParserProperty::name() const
+QString QDeclarativeCustomParserProperty::name() const
 {
     return d->name;
 }
@@ -292,7 +292,7 @@ int QDeclarativeCustomParser::evaluateEnum(const QByteArray& script) const
     Resolves \a name to a type, or 0 if it is not a type. This can be used
     to type-check object nodes.
 */
-const QMetaObject *QDeclarativeCustomParser::resolveType(const QByteArray& name) const
+const QMetaObject *QDeclarativeCustomParser::resolveType(const QString& name) const
 {
     return compiler->resolveType(name);
 }
@@ -302,7 +302,7 @@ const QMetaObject *QDeclarativeCustomParser::resolveType(const QByteArray& name)
     used to construct the binding later. \a name
     is used as the name of the rewritten function.
 */
-QDeclarativeBinding::Identifier QDeclarativeCustomParser::rewriteBinding(const QString& expression, const QByteArray& name)
+QDeclarativeBinding::Identifier QDeclarativeCustomParser::rewriteBinding(const QString& expression, const QString& name)
 {
     return compiler->rewriteBinding(expression, name);
 }
index 47b3ee8..9aca803 100644 (file)
@@ -78,7 +78,7 @@ public:
     QDeclarativeCustomParserProperty &operator=(const QDeclarativeCustomParserProperty &);
     ~QDeclarativeCustomParserProperty();
 
-    QByteArray name() const;
+    QString name() const;
     QDeclarativeScript::Location location() const;
 
     bool isList() const;
@@ -101,7 +101,7 @@ public:
     QDeclarativeCustomParserNode &operator=(const QDeclarativeCustomParserNode &);
     ~QDeclarativeCustomParserNode();
 
-    QByteArray name() const;
+    QString name() const;
     QDeclarativeScript::Location location() const;
 
     QList<QDeclarativeCustomParserProperty> properties() const;
@@ -140,9 +140,9 @@ protected:
 
     int evaluateEnum(const QByteArray&) const;
 
-    const QMetaObject *resolveType(const QByteArray&) const;
+    const QMetaObject *resolveType(const QString&) const;
 
-    QDeclarativeBinding::Identifier rewriteBinding(const QString&, const QByteArray&);
+    QDeclarativeBinding::Identifier rewriteBinding(const QString&, const QString&);
 
 private:
     QList<QDeclarativeError> exceptions;
index b11cb34..cebad26 100644 (file)
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
 class QDeclarativeCustomParserNodePrivate
 {
 public:
-    QByteArray name;
+    QString name;
     QList<QDeclarativeCustomParserProperty> properties;
     QDeclarativeScript::Location location;
 
@@ -78,7 +78,7 @@ public:
     QDeclarativeCustomParserPropertyPrivate()
         : isList(false) {}
 
-    QByteArray name;
+    QString name;
     bool isList;
     QDeclarativeScript::Location location;
     QList<QVariant> values;
index 69c323b..08d953f 100644 (file)
@@ -186,7 +186,7 @@ bool QDeclarativeDirParser::parse()
                             QString::fromUtf8("internal types require 2 arguments, but %1 were provided").arg(sectionCount - 1));
                 continue;
             }
-            Component entry(sections[1].toUtf8(), sections[2], -1, -1);
+            Component entry(sections[1], sections[2], -1, -1);
             entry.internal = true;
             _components.append(entry);
         } else if (sections[0] == QLatin1String("typeinfo")) {
@@ -202,7 +202,7 @@ bool QDeclarativeDirParser::parse()
 
         } else if (sectionCount == 2) {
             // No version specified (should only be used for relative qmldir files)
-            const Component entry(sections[0].toUtf8(), sections[1], -1, -1);
+            const Component entry(sections[0], sections[1], -1, -1);
             _components.append(entry);
         } else if (sectionCount == 3) {
             const QString &version = sections[1];
@@ -220,7 +220,7 @@ bool QDeclarativeDirParser::parse()
                     const int minorVersion = version.mid(dotIndex + 1).toInt(&validVersionNumber);
 
                     if (validVersionNumber) {
-                        const Component entry(sections[0].toUtf8(), sections[2], majorVersion, minorVersion);
+                        const Component entry(sections[0], sections[2], majorVersion, minorVersion);
 
                         _components.append(entry);
                     }
index 8540747..696c2e1 100644 (file)
@@ -98,11 +98,11 @@ public:
         Component()
             : majorVersion(0), minorVersion(0), internal(false) {}
 
-        Component(const QByteArray &typeName, const QString &fileName, int majorVersion, int minorVersion)
+        Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion)
             : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion),
             internal(false) {}
 
-        QByteArray typeName;
+        QString typeName;
         QString fileName;
         int majorVersion;
         int minorVersion;
index 4c8d48f..1e35f0a 100644 (file)
@@ -952,7 +952,7 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object)
         if (QDeclarativeDebugService::isDebuggingEnabled()) {
             QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating);
             QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
-            QString typeName = type ? QLatin1String(type->qmlTypeName()) : QString::fromLatin1(object->metaObject()->className());
+            QString typeName = type ? type->qmlTypeName() : QString::fromUtf8(object->metaObject()->className());
             QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, typeName);
             if (data->outerContext)
                 QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Creating, data->outerContext->url, data->lineNumber);
@@ -1580,7 +1580,7 @@ QDeclarativePropertyCache *QDeclarativeEnginePrivate::createCache(QDeclarativeTy
     if (overloadError) {
         if (hasCopied) raw->release();
 
-        error.setDescription(QLatin1String("Type ") + QString::fromUtf8(type->qmlTypeName()) + QLatin1String(" ") + QString::number(type->majorVersion()) + QLatin1String(".") + QString::number(minorVersion) + QLatin1String(" contains an illegal property \"") + overloadName + QLatin1String("\".  This is an error in the type's implementation."));
+        error.setDescription(QLatin1String("Type ") + type->qmlTypeName() + QLatin1String(" ") + QString::number(type->majorVersion()) + QLatin1String(".") + QString::number(minorVersion) + QLatin1String(" contains an illegal property \"") + overloadName + QLatin1String("\".  This is an error in the type's implementation."));
         return 0;
     }
 
index e9ee699..9feea5c 100644 (file)
@@ -222,7 +222,7 @@ public:
 
     QString url; // This is a QString for a reason.  QUrls are slooooooow...
     int line;
-    QByteArray name; //function name, hint for the debugger
+    QString name; //function name, hint for the debugger
 
     QDeclarativeRefCount *dataRef;
 };
index 995a6b9..d221eae 100644 (file)
@@ -120,7 +120,7 @@ QDeclarativeInfo::~QDeclarativeInfo()
                 QString typeName;
                 QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
                 if (type) {
-                    typeName = QLatin1String(type->qmlTypeName());
+                    typeName = type->qmlTypeName();
                     int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
                     if (lastSlash != -1)
                         typeName = typeName.mid(lastSlash+1);
@@ -136,7 +136,7 @@ QDeclarativeInfo::~QDeclarativeInfo()
                         typeName += QLatin1Char('*');
                         type = QDeclarativeMetaType::qmlType(QMetaType::type(typeName.toLatin1()));
                         if (type) {
-                            typeName = QLatin1String(type->qmlTypeName());
+                            typeName = type->qmlTypeName();
                             int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
                             if (lastSlash != -1)
                                 typeName = typeName.mid(lastSlash+1);
index 4289dee..ebe9808 100644 (file)
@@ -180,7 +180,7 @@ public:
     bool m_isInterface : 1;
     const char *m_iid;
     QString m_module;
-    QByteArray m_name;
+    QString m_name;
     QString m_elementName;
     int m_version_maj;
     int m_version_min;
@@ -242,9 +242,9 @@ QDeclarativeType::QDeclarativeType(int index, const QDeclarativePrivate::Registe
 QDeclarativeType::QDeclarativeType(int index, const QDeclarativePrivate::RegisterType &type)
 : d(new QDeclarativeTypePrivate)
 {
-    QByteArray name = type.uri;
-    if (type.uri) name += '/';
-    name += type.elementName;
+    QString name = QString::fromUtf8(type.uri);
+    if (type.uri) name += QLatin1Char('/');
+    name += QString::fromUtf8(type.elementName);
 
     d->m_module = QString::fromUtf8(type.uri);
     d->m_name = name;
@@ -517,14 +517,14 @@ QByteArray QDeclarativeType::typeName() const
 const QString &QDeclarativeType::elementName() const
 {
     if (d->m_elementName.isEmpty()) {
-        QByteArray n = qmlTypeName();
-        int idx = n.lastIndexOf('/');
-        d->m_elementName = QString::fromUtf8(n.mid(idx + 1));
+        QString n = qmlTypeName();
+        int idx = n.lastIndexOf(QLatin1Char('/'));
+        d->m_elementName = n.mid(idx + 1);
     }
     return d->m_elementName;
 }
 
-const QByteArray &QDeclarativeType::qmlTypeName() const
+const QString &QDeclarativeType::qmlTypeName() const
 {
     return d->m_name;
 }
@@ -861,7 +861,7 @@ int registerInterface(const QDeclarativePrivate::RegisterInterface &interface)
     data->idToType.insert(type->qListTypeId(), type);
     // XXX No insertMulti, so no multi-version interfaces?
     if (!type->qmlTypeName().isEmpty())
-        data->nameToType.insert(QString::fromUtf8(type->qmlTypeName()), type);
+        data->nameToType.insert(type->qmlTypeName(), type);
 
     if (data->interfaces.size() <= interface.typeId)
         data->interfaces.resize(interface.typeId + 16);
@@ -895,7 +895,7 @@ int registerType(const QDeclarativePrivate::RegisterType &type)
     if (dtype->qListTypeId()) data->idToType.insert(dtype->qListTypeId(), dtype);
 
     if (!dtype->qmlTypeName().isEmpty())
-        data->nameToType.insertMulti(QString::fromUtf8(dtype->qmlTypeName()), dtype);
+        data->nameToType.insertMulti(dtype->qmlTypeName(), dtype);
 
     data->metaObjectToType.insertMulti(dtype->baseMetaObject(), dtype);
 
index 2a6ce20..39e8b85 100644 (file)
@@ -137,7 +137,7 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeType
 {
 public:
     QByteArray typeName() const;
-    const QByteArray &qmlTypeName() const;
+    const QString &qmlTypeName() const;
     const QString &elementName() const;
 
     QString module() const;
index 9e6e09e..8fb423c 100644 (file)
@@ -736,7 +736,7 @@ ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName,
 
         // XXX this doesn't do anything (_scope never builds up)
         _scope.append(resolvableObjectType);
-        obj->typeName = qualifiedNameId().toUtf8();
+        obj->typeName = qualifiedNameId();
         _scope.removeLast();
 
         obj->location = location;
index a985fd7..e270241 100644 (file)
@@ -309,7 +309,7 @@ public:
     int type;
 
     // The fully-qualified name of this type
-    QByteArray typeName;
+    QString typeName;
     // The id assigned to the object (if any).  Set by the QDeclarativeCompiler
     QString id;
     // The id index assigned to the object (if any).  Set by the QDeclarativeCompiler
index d3748a4..bf81ae4 100644 (file)
@@ -793,7 +793,7 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors,
             QDeclarativeExpression *expr = 
                 new QDeclarativeExpression(CTXT, context, PRIMITIVES.at(instr.value));
             expr->setSourceLocation(COMP->name, instr.line);
-            static_cast<QDeclarativeExpressionPrivate *>(QObjectPrivate::get(expr))->name = DATAS.at(instr.name);
+            static_cast<QDeclarativeExpressionPrivate *>(QObjectPrivate::get(expr))->name = QString::fromUtf8(DATAS.at(instr.name));
             bs->setExpression(expr);
         QML_END_INSTR(StoreSignal)
 
index 57bb79c..adb9b15 100644 (file)
@@ -202,7 +202,7 @@ QDeclarativeConnectionsParser::compile(const QList<QDeclarativeCustomParserPrope
 
     for(int ii = 0; ii < props.count(); ++ii)
     {
-        QString propName = QString::fromUtf8(props.at(ii).name());
+        QString propName = props.at(ii).name();
         if (!propName.startsWith(QLatin1String("on")) || !propName.at(2).isUpper()) {
             error(props.at(ii), QDeclarativeConnections::tr("Cannot assign to non-existent property \"%1\"").arg(propName));
             return QByteArray();
index 3add850..cf1dd3b 100644 (file)
@@ -792,14 +792,14 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser
                     error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot contain nested elements"));
                     return false;
                 }
-                if (nodeProp.name() == "id") {
+                if (nodeProp.name() == QStringLiteral("id")) {
                     error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot use reserved \"id\" property"));
                     return false;
                 }
 
                 ListInstruction li;
                 int ref = data.count();
-                data.append(nodeProp.name());
+                data.append(nodeProp.name().toUtf8());
                 data.append('\0');
                 li.type = ListInstruction::Set;
                 li.dataIdx = ref;
@@ -895,12 +895,12 @@ QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomPa
 {
     QList<ListInstruction> instr;
     QByteArray data;
-    listElementTypeName = QByteArray(); // unknown
+    listElementTypeName = QString(); // unknown
 
     for(int ii = 0; ii < customProps.count(); ++ii) {
         const QDeclarativeCustomParserProperty &prop = customProps.at(ii);
         if(!prop.name().isEmpty()) { // isn't default property
-            error(prop, QDeclarativeListModel::tr("ListModel: undefined property '%1'").arg(QString::fromUtf8(prop.name())));
+            error(prop, QDeclarativeListModel::tr("ListModel: undefined property '%1'").arg(prop.name()));
             return QByteArray();
         }
 
index e7c5632..ea83ae1 100644 (file)
@@ -145,7 +145,7 @@ private:
 
     bool definesEmptyList(const QString &);
 
-    QByteArray listElementTypeName;
+    QString listElementTypeName;
 };
 
 
index 0398030..3684b38 100644 (file)
@@ -240,11 +240,11 @@ public:
 };
 
 void
-QDeclarativePropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant> > &list,
-                                     const QByteArray &pre,
+QDeclarativePropertyChangesParser::compileList(QList<QPair<QString, QVariant> > &list,
+                                     const QString &pre,
                                      const QDeclarativeCustomParserProperty &prop)
 {
-    QByteArray propName = pre + prop.name();
+    QString propName = pre + prop.name();
 
     QList<QVariant> values = prop.assignedValues();
     for (int ii = 0; ii < values.count(); ++ii) {
@@ -258,7 +258,7 @@ QDeclarativePropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant>
 
             QDeclarativeCustomParserProperty prop =
                 qvariant_cast<QDeclarativeCustomParserProperty>(value);
-            QByteArray pre = propName + '.';
+            QString pre = propName + QLatin1Char('.');
             compileList(list, pre, prop);
 
         } else {
@@ -270,9 +270,9 @@ QDeclarativePropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant>
 QByteArray
 QDeclarativePropertyChangesParser::compile(const QList<QDeclarativeCustomParserProperty> &props)
 {
-    QList<QPair<QByteArray, QVariant> > data;
+    QList<QPair<QString, QVariant> > data;
     for(int ii = 0; ii < props.count(); ++ii)
-        compileList(data, QByteArray(), props.at(ii));
+        compileList(data, QString(), props.at(ii));
 
     QByteArray rv;
     QDataStream ds(&rv, QIODevice::WriteOnly);
@@ -304,7 +304,7 @@ QDeclarativePropertyChangesParser::compile(const QList<QDeclarativeCustomParserP
             break;
         }
 
-        ds << QString::fromUtf8(data.at(ii).first) << isScript << var;
+        ds << data.at(ii).first << isScript << var;
         if (isScript)
             ds << id;
     }
index cb553e0..fe3dc39 100644 (file)
@@ -96,7 +96,7 @@ public:
     QDeclarativePropertyChangesParser()
     : QDeclarativeCustomParser(AcceptsAttachedProperties) {}
 
-    void compileList(QList<QPair<QByteArray, QVariant> > &list, const QByteArray &pre, const QDeclarativeCustomParserProperty &prop);
+    void compileList(QList<QPair<QString, QVariant> > &list, const QString &pre, const QDeclarativeCustomParserProperty &prop);
 
     virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &);
     virtual void setCustomData(QObject *, const QByteArray &);
index 1631831..9cd4060 100644 (file)
@@ -165,7 +165,7 @@ QDeclarativeGestureAreaParser::compile(const QList<QDeclarativeCustomParserPrope
 
     for(int ii = 0; ii < props.count(); ++ii)
     {
-        QString propName = QString::fromUtf8(props.at(ii).name());
+        QString propName = props.at(ii).name();
         Qt::GestureType type;
 
         if (propName == QLatin1String("onTap")) {
index 54f51ac..03c7a92 100644 (file)
@@ -205,7 +205,7 @@ QDeclarative1ConnectionsParser::compile(const QList<QDeclarativeCustomParserProp
 
     for(int ii = 0; ii < props.count(); ++ii)
     {
-        QString propName = QString::fromUtf8(props.at(ii).name());
+        QString propName = props.at(ii).name();
         if (!propName.startsWith(QLatin1String("on")) || !propName.at(2).isUpper()) {
             error(props.at(ii), QDeclarative1Connections::tr("Cannot assign to non-existent property \"%1\"").arg(propName));
             return QByteArray();
index fc063ca..692d7bb 100644 (file)
@@ -243,11 +243,11 @@ public:
 };
 
 void
-QDeclarative1PropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant> > &list,
-                                     const QByteArray &pre,
+QDeclarative1PropertyChangesParser::compileList(QList<QPair<QString, QVariant> > &list,
+                                     const QString &pre,
                                      const QDeclarativeCustomParserProperty &prop)
 {
-    QByteArray propName = pre + prop.name();
+    QString propName = pre + prop.name();
 
     QList<QVariant> values = prop.assignedValues();
     for (int ii = 0; ii < values.count(); ++ii) {
@@ -261,7 +261,7 @@ QDeclarative1PropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant
 
             QDeclarativeCustomParserProperty prop =
                 qvariant_cast<QDeclarativeCustomParserProperty>(value);
-            QByteArray pre = propName + '.';
+            QString pre = propName + QLatin1Char('.');
             compileList(list, pre, prop);
 
         } else {
@@ -273,9 +273,9 @@ QDeclarative1PropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant
 QByteArray
 QDeclarative1PropertyChangesParser::compile(const QList<QDeclarativeCustomParserProperty> &props)
 {
-    QList<QPair<QByteArray, QVariant> > data;
+    QList<QPair<QString, QVariant> > data;
     for(int ii = 0; ii < props.count(); ++ii)
-        compileList(data, QByteArray(), props.at(ii));
+        compileList(data, QString(), props.at(ii));
 
     QByteArray rv;
     QDataStream ds(&rv, QIODevice::WriteOnly);
@@ -307,7 +307,7 @@ QDeclarative1PropertyChangesParser::compile(const QList<QDeclarativeCustomParser
             break;
         }
 
-        ds << QString::fromUtf8(data.at(ii).first) << isScript << var;
+        ds << data.at(ii).first << isScript << var;
         if (isScript)
             ds << id;
     }
index b3aed08..ef3bc00 100644 (file)
@@ -96,7 +96,7 @@ public:
     QDeclarative1PropertyChangesParser()
     : QDeclarativeCustomParser(AcceptsAttachedProperties) {}
 
-    void compileList(QList<QPair<QByteArray, QVariant> > &list, const QByteArray &pre, const QDeclarativeCustomParserProperty &prop);
+    void compileList(QList<QPair<QString, QVariant> > &list, const QString &pre, const QDeclarativeCustomParserProperty &prop);
 
     virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &);
     virtual void setCustomData(QObject *, const QByteArray &);
index 6132d15..35e90cd 100644 (file)
@@ -204,8 +204,8 @@ QSet<const QMetaObject *> collectReachableMetaObjects(const QList<QDeclarativeTy
         if (ty->typeName() == "QDeclarativeComponent")
             continue;
 
-        QByteArray tyName = ty->qmlTypeName();
-        tyName = tyName.mid(tyName.lastIndexOf('/') + 1);
+        QString tyName = ty->qmlTypeName();
+        tyName = tyName.mid(tyName.lastIndexOf(QLatin1Char('/')) + 1);
         if (tyName.isEmpty())
             continue;
 
@@ -583,8 +583,8 @@ int main(int argc, char *argv[])
             qWarning() << "Could not find QtObject type";
             importCode = QByteArray("import QtQuick 2.0\n");
         } else {
-            QByteArray module = qtObjectType->qmlTypeName();
-            module = module.mid(0, module.lastIndexOf('/'));
+            QString module = qtObjectType->qmlTypeName();
+            module = module.mid(0, module.lastIndexOf(QLatin1Char('/')));
             importCode = QString("import %1 %2.%3\n").arg(module,
                                                           QString::number(qtObjectType->majorVersion()),
                                                           QString::number(qtObjectType->minorVersion())).toUtf8();