#include <private/qqmlscriptstring_p.h>
#include <private/qqmlcontextwrapper_p.h>
#include <private/qqmlbuiltinfunctions_p.h>
+#include <private/qqmlvmemetaobject_p.h>
#include <QVariant>
#include <QtCore/qdebug.h>
{
m_coreObject = object;
m_core = core;
+
+ while (m_core.isAlias()) {
+ int coreIndex = core.coreIndex;
+ int valueTypeIndex = core.getValueTypeCoreIndex();
+ QQmlVMEMetaObject *vme = QQmlVMEMetaObject::getForProperty(object, coreIndex);
+
+ int aValueTypeIndex;
+ if (!vme->aliasTarget(coreIndex, &object, &coreIndex, &aValueTypeIndex)) {
+ m_core.coreIndex = -1;
+ m_coreObject = 0;
+ return;
+ }
+ if (valueTypeIndex == -1)
+ valueTypeIndex = aValueTypeIndex;
+
+ QQmlData *data = QQmlData::get(object, false);
+ if (!data || !data->propertyCache) {
+ m_core.coreIndex = -1;
+ m_coreObject = 0;
+ return;
+ }
+ QQmlPropertyData *propertyData = data->propertyCache->property(coreIndex);
+ Q_ASSERT(propertyData);
+
+ m_coreObject = object;
+ m_core = *propertyData;
+ if (valueTypeIndex != -1) {
+ const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(m_core.propType);
+ Q_ASSERT(valueTypeMetaObject);
+ QMetaProperty vtProp = valueTypeMetaObject->property(valueTypeIndex);
+ m_core.setFlags(m_core.getFlags() | QQmlPropertyData::IsValueTypeVirtual);
+ m_core.valueTypeFlags = QQmlPropertyData::flagsForProperty(vtProp);
+ m_core.valueTypePropType = vtProp.userType();
+ m_core.valueTypeCoreIndex = valueTypeIndex;
+ }
+ }
}
QQmlProperty QQmlBinding::property() const
}
if (newBinding) {
- if (newBinding->targetPropertyIndex() != index || newBinding->targetObject() != object) {
- QQmlData *data = QQmlData::get(object, true);
- if (data && data->propertyCache) {
- QQmlPropertyData propertyData = *data->propertyCache->property(coreIndex);
- if (valueTypeIndex != -1) {
- const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(propertyData.propType);
- Q_ASSERT(valueTypeMetaObject);
- QMetaProperty vtProp = valueTypeMetaObject->property(valueTypeIndex);
- propertyData.setFlags(propertyData.getFlags() | QQmlPropertyData::IsValueTypeVirtual);
- propertyData.valueTypeFlags = QQmlPropertyData::flagsForProperty(vtProp);
- propertyData.valueTypePropType = vtProp.userType();
- propertyData.valueTypeCoreIndex = valueTypeIndex;
- }
- static_cast<QQmlBinding *>(newBinding)->setTarget(object, propertyData);
- }
- }
-
Q_ASSERT(newBinding->targetPropertyIndex() == index);
Q_ASSERT(newBinding->targetObject() == object);
binding->removeFromObject();
if (newBinding) {
- if (newBinding->targetPropertyIndex() != index || newBinding->targetObject() != object) {
- QQmlData *data = QQmlData::get(object, true);
- if (data && data->propertyCache) {
- QQmlPropertyData propertyData = *data->propertyCache->property(coreIndex);
- if (valueTypeIndex != -1) {
- const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(propertyData.propType);
- Q_ASSERT(valueTypeMetaObject);
- QMetaProperty vtProp = valueTypeMetaObject->property(valueTypeIndex);
- propertyData.setFlags(propertyData.getFlags() | QQmlPropertyData::IsValueTypeVirtual);
- propertyData.valueTypeFlags = QQmlPropertyData::flagsForProperty(vtProp);
- propertyData.valueTypePropType = vtProp.userType();
- propertyData.valueTypeCoreIndex = valueTypeIndex;
- }
- static_cast<QQmlBinding *>(newBinding)->setTarget(object, propertyData);
- }
- }
-
Q_ASSERT(newBinding->targetPropertyIndex() == index);
Q_ASSERT(newBinding->targetObject() == object);