diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-09-20 16:29:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 22:14:55 +0200 |
commit | 642b2ce0e155df452821a84726a2b0226cb65f70 (patch) | |
tree | 74b5f133cd65a315fba48a3ed76c880a4ebe4066 /src/qml | |
parent | 495358cb089bf1dbbbf7d83ec5c19225fb934389 (diff) |
[new compiler] Add support for default properties
When trying to determine the destination property for a binding, properly
fall back to the default property if existent.
Fixes tst_qqmllanguage::simpleContainer
Change-Id: Icb7752f088e92e09f03b1b66f43c882e7089f3cd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index ca6fc7edf4..fe7995ea59 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -942,16 +942,26 @@ void QmlObjectCreator::setupBindings() qSwap(_currentList, savedList); QQmlPropertyData *property = 0; + bool defaultPropertyQueried = false; + QQmlPropertyData *defaultProperty = 0; const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable(); for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) { + QString name = stringAt(binding->propertyNameIndex); + if (name.isEmpty()) + property = 0; + if (!property || (i > 0 && (binding - 1)->propertyNameIndex != binding->propertyNameIndex)) { - QString name = stringAt(binding->propertyNameIndex); if (!name.isEmpty()) property = _propertyCache->property(name, _qobject, context); - else - property = 0; + else { + if (!defaultPropertyQueried) { + defaultProperty = _propertyCache->defaultProperty(); + defaultPropertyQueried = true; + } + property = defaultProperty; + } if (property && property->isQList()) { void *argv[1] = { (void*)&_currentList }; |