aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-23 08:19:40 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-25 13:13:30 +0200
commitf1901b9289d10eb4696336c969ae49512b9930b3 (patch)
treefab3cea71bc88dc56809633c611ace20184f7771
parentbbbb33011a080476b439fdd8d0b46f17d1a02839 (diff)
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>
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 5bcf134128..292df56f24 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -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) {