diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-03-06 16:19:42 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 18:31:21 +0100 |
commit | 914b72418b7e766026f2679254fcee93fc920866 (patch) | |
tree | 202634bd203c830ddc7eeb7dab1d071ca506b8a3 /src/qml/qml/qqmlobjectcreator.cpp | |
parent | af7ba8a6194b83fe7380b8d4ae027e2f04e21f17 (diff) |
Add support for resolving translation bindings at compile time
Simple calls to qsTr and qsTrId are detected at type compile time and
reduced to a special Translation and TranslationById binding type, which
avoids allocating a QML binding at type instantiation type just to perform
a translation.
Change-Id: I61e4f2db2a8092b5e6870e174b832d9c20cd62b5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 150401a358..264ada2507 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -359,14 +359,14 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4:: } break; case QVariant::String: { - Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_String); + Q_ASSERT(binding->evaluatesToString()); QString value = binding->valueAsString(&qmlUnit->header); argv[0] = &value; QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv); } break; case QVariant::StringList: { - Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_String); + Q_ASSERT(binding->evaluatesToString()); QStringList value(binding->valueAsString(&qmlUnit->header)); argv[0] = &value; QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv); @@ -586,7 +586,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4:: QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv); break; } else if (property->propType == qMetaTypeId<QList<QString> >()) { - Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_String); + Q_ASSERT(binding->evaluatesToString()); QList<QString> value; value.append(binding->valueAsString(&qmlUnit->header)); argv[0] = reinterpret_cast<void *>(&value); |