aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2011-09-29 10:29:22 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-29 14:59:15 +0200
commitbcc9a4b3d10899f23b304fecb581aa0d50e1b4e5 (patch)
tree557b4391429873a0a30e122059a9b1207a1ddb3d
parent15a52c1a5f9cf166305c264abc01e35bad918d84 (diff)
Remove more QByteArray<->QString conversions
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>
-rw-r--r--src/declarative/debugger/qdeclarativeenginedebugservice.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp10
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp6
-rw-r--r--src/declarative/qml/qdeclarativecustomparser.cpp10
-rw-r--r--src/declarative/qml/qdeclarativecustomparser_p.h8
-rw-r--r--src/declarative/qml/qdeclarativecustomparser_p_p.h4
-rw-r--r--src/declarative/qml/qdeclarativedirparser.cpp6
-rw-r--r--src/declarative/qml/qdeclarativedirparser_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeexpression_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp4
-rw-r--r--src/declarative/qml/qdeclarativemetatype.cpp20
-rw-r--r--src/declarative/qml/qdeclarativemetatype_p.h2
-rw-r--r--src/declarative/qml/qdeclarativescript.cpp2
-rw-r--r--src/declarative/qml/qdeclarativescript_p.h2
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp2
-rw-r--r--src/declarative/util/qdeclarativeconnections.cpp2
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp8
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p.h2
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp14
-rw-r--r--src/declarative/util/qdeclarativepropertychanges_p.h2
-rw-r--r--src/imports/gestures/qdeclarativegesturearea.cpp2
-rw-r--r--src/qtquick1/util/qdeclarativeconnections.cpp2
-rw-r--r--src/qtquick1/util/qdeclarativepropertychanges.cpp14
-rw-r--r--src/qtquick1/util/qdeclarativepropertychanges_p.h2
-rw-r--r--tools/qmlplugindump/main.cpp8
27 files changed, 73 insertions, 73 deletions
diff --git a/src/declarative/debugger/qdeclarativeenginedebugservice.cpp b/src/declarative/debugger/qdeclarativeenginedebugservice.cpp
index 9841f8778e..9ba99afb91 100644
--- a/src/declarative/debugger/qdeclarativeenginedebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativeenginedebugservice.cpp
@@ -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 {
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 8c26a3bfa6..69df595bb5 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -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;
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index 993c733d40..5e3ad03924 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -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:
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 0d390b093a..2f1ad82138 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -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();
}
}
}
diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp
index e806707a06..4327110d18 100644
--- a/src/declarative/qml/qdeclarativecustomparser.cpp
+++ b/src/declarative/qml/qdeclarativecustomparser.cpp
@@ -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);
}
diff --git a/src/declarative/qml/qdeclarativecustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h
index 47b3ee8f8e..9aca8030c7 100644
--- a/src/declarative/qml/qdeclarativecustomparser_p.h
+++ b/src/declarative/qml/qdeclarativecustomparser_p.h
@@ -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;
diff --git a/src/declarative/qml/qdeclarativecustomparser_p_p.h b/src/declarative/qml/qdeclarativecustomparser_p_p.h
index b11cb3432d..cebad26b33 100644
--- a/src/declarative/qml/qdeclarativecustomparser_p_p.h
+++ b/src/declarative/qml/qdeclarativecustomparser_p_p.h
@@ -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;
diff --git a/src/declarative/qml/qdeclarativedirparser.cpp b/src/declarative/qml/qdeclarativedirparser.cpp
index 69c323b3c6..08d953f3e4 100644
--- a/src/declarative/qml/qdeclarativedirparser.cpp
+++ b/src/declarative/qml/qdeclarativedirparser.cpp
@@ -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);
}
diff --git a/src/declarative/qml/qdeclarativedirparser_p.h b/src/declarative/qml/qdeclarativedirparser_p.h
index 8540747055..696c2e1932 100644
--- a/src/declarative/qml/qdeclarativedirparser_p.h
+++ b/src/declarative/qml/qdeclarativedirparser_p.h
@@ -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;
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 4c8d48f6ef..1e35f0a0ba 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -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;
}
diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h
index e9ee69960e..9feea5ca22 100644
--- a/src/declarative/qml/qdeclarativeexpression_p.h
+++ b/src/declarative/qml/qdeclarativeexpression_p.h
@@ -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;
};
diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp
index 995a6b9ad7..d221eaeefb 100644
--- a/src/declarative/qml/qdeclarativeinfo.cpp
+++ b/src/declarative/qml/qdeclarativeinfo.cpp
@@ -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);
diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp
index 4289dee907..ebe9808db3 100644
--- a/src/declarative/qml/qdeclarativemetatype.cpp
+++ b/src/declarative/qml/qdeclarativemetatype.cpp
@@ -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);
diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h
index 2a6ce20bbb..39e8b850d0 100644
--- a/src/declarative/qml/qdeclarativemetatype_p.h
+++ b/src/declarative/qml/qdeclarativemetatype_p.h
@@ -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;
diff --git a/src/declarative/qml/qdeclarativescript.cpp b/src/declarative/qml/qdeclarativescript.cpp
index 9e6e09ed0c..8fb423c308 100644
--- a/src/declarative/qml/qdeclarativescript.cpp
+++ b/src/declarative/qml/qdeclarativescript.cpp
@@ -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;
diff --git a/src/declarative/qml/qdeclarativescript_p.h b/src/declarative/qml/qdeclarativescript_p.h
index a985fd7a8a..e27024161b 100644
--- a/src/declarative/qml/qdeclarativescript_p.h
+++ b/src/declarative/qml/qdeclarativescript_p.h
@@ -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
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index d3748a4974..bf81ae4fde 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -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)
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
index 57bb79c302..adb9b15fe7 100644
--- a/src/declarative/util/qdeclarativeconnections.cpp
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -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();
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 3add850570..cf1dd3b894 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -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();
}
diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h
index e7c5632ce3..ea83ae1e7e 100644
--- a/src/declarative/util/qdeclarativelistmodel_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p.h
@@ -145,7 +145,7 @@ private:
bool definesEmptyList(const QString &);
- QByteArray listElementTypeName;
+ QString listElementTypeName;
};
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index 039803002c..3684b38048 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -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;
}
diff --git a/src/declarative/util/qdeclarativepropertychanges_p.h b/src/declarative/util/qdeclarativepropertychanges_p.h
index cb553e032b..fe3dc39626 100644
--- a/src/declarative/util/qdeclarativepropertychanges_p.h
+++ b/src/declarative/util/qdeclarativepropertychanges_p.h
@@ -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 &);
diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp
index 1631831c7f..9cd4060ab5 100644
--- a/src/imports/gestures/qdeclarativegesturearea.cpp
+++ b/src/imports/gestures/qdeclarativegesturearea.cpp
@@ -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")) {
diff --git a/src/qtquick1/util/qdeclarativeconnections.cpp b/src/qtquick1/util/qdeclarativeconnections.cpp
index 54f51acd12..03c7a9265d 100644
--- a/src/qtquick1/util/qdeclarativeconnections.cpp
+++ b/src/qtquick1/util/qdeclarativeconnections.cpp
@@ -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();
diff --git a/src/qtquick1/util/qdeclarativepropertychanges.cpp b/src/qtquick1/util/qdeclarativepropertychanges.cpp
index fc063cafb0..692d7bbb60 100644
--- a/src/qtquick1/util/qdeclarativepropertychanges.cpp
+++ b/src/qtquick1/util/qdeclarativepropertychanges.cpp
@@ -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;
}
diff --git a/src/qtquick1/util/qdeclarativepropertychanges_p.h b/src/qtquick1/util/qdeclarativepropertychanges_p.h
index b3aed087e3..ef3bc003fa 100644
--- a/src/qtquick1/util/qdeclarativepropertychanges_p.h
+++ b/src/qtquick1/util/qdeclarativepropertychanges_p.h
@@ -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 &);
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 6132d15d0d..35e90cd3d4 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -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();