Fix setting the id property when also present in the type itself

Fixes tst_qqmllanguage::idProperty

Change-Id: I3051da6a55f29bfca58aa83647fe5d51fb2a67e0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Simon Hausmann 2013-09-23 08:19:40 +02:00 committed by The Qt Project
parent bbbb33011a
commit f1901b9289
1 changed files with 14 additions and 0 deletions

View File

@ -945,6 +945,20 @@ void QmlObjectCreator::setupBindings()
bool defaultPropertyQueried = false;
QQmlPropertyData *defaultProperty = 0;
QString id = stringAt(_compiledObject->idIndex);
if (!id.isEmpty()) {
QQmlPropertyData *idProperty = _propertyCache->property(QStringLiteral("id"), _qobject, context);
if (idProperty) {
QV4::CompiledData::Binding idBinding;
idBinding.propertyNameIndex = 0; // Not used
idBinding.flags = 0;
idBinding.type = QV4::CompiledData::Binding::Type_String;
idBinding.stringIndex = _compiledObject->idIndex;
idBinding.location = _compiledObject->location; // ###
setPropertyValue(idProperty, &idBinding);
}
}
const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable();
for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) {