C++: Accept UTF-8 byte arrays in type of expression

The model uses UTF-8 internally and it makes more sense to only
convert when necessary.

A following commit will rename the source/setSource methods in
document for more clarity too.

Change-Id: I960ea0754efabd1436ad4b4299a57faeb65a8bee
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Leandro Melo
2012-01-12 17:35:37 +01:00
parent edcb065edb
commit fd179ed951
11 changed files with 51 additions and 51 deletions

View File

@@ -506,7 +506,7 @@ static QString toQmlType(const FullySpecifiedType &type)
static Class *lookupClass(const QString &expression, Scope *scope, TypeOfExpression &typeOf)
{
QList<LookupItem> results = typeOf(expression, scope);
QList<LookupItem> results = typeOf(expression.toUtf8(), scope);
Class *klass = 0;
foreach (const LookupItem &item, results) {
if (item.declaration()) {
@@ -576,7 +576,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
if (QtEnum *qtEnum = member->asQtEnum()) {
// find the matching enum
Enum *e = 0;
QList<LookupItem> result = typeOf(namePrinter(qtEnum->name()), klass);
QList<LookupItem> result = typeOf(namePrinter(qtEnum->name()).toUtf8(), klass);
foreach (const LookupItem &item, result) {
if (item.declaration()) {
e = item.declaration()->asEnum();
@@ -648,7 +648,7 @@ static void buildContextProperties(
foreach (const ContextProperty &property, contextPropertyDescriptions) {
Scope *scope = doc->scopeAt(property.line, property.column);
QList<LookupItem> results = typeOf(property.expression, scope);
QList<LookupItem> results = typeOf(property.expression.toUtf8(), scope);
QString typeName;
if (!results.isEmpty()) {
LookupItem result = results.first();