aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcompiler.cpp
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-06-03 21:10:32 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-12 12:06:09 +0200
commitc421281a0291fd48c616a6e37315364ce0553c0f (patch)
treeda71d664288d4aaaf3836a03c0c1d645a81670ea /src/qml/qml/qqmlcompiler.cpp
parentf4a683f6874b03ce3e0a2869320a9956d5a04098 (diff)
Adapt to connection-related changes in qtbase
The QQmlData hooks signalEmitted() and receivers() now receive the index in the signal index range (i.e., excluding non-signal methods). This was done to avoid Q(Meta)Object having to compute the class's method offset; the signal offset should be sufficient for everyone. This required adapting QQmlNotifier, QQmlBoundSignal, QQmlPropertyCache and friends to use the signal index range whenever a property's notify signal is involved in the internal connection lists and property captures. Using the signal index range also reduces the memory used for NotifyList::notifies, since useless entries for non-signal methods will no longer be created. Change-Id: I62872fbea5a1f829b8b03bae3fc1e6acd84cf886 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlcompiler.cpp')
-rw-r--r--src/qml/qml/qqmlcompiler.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index 218d719634..8450221a1f 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -1669,7 +1669,7 @@ bool QQmlCompiler::buildSignal(QQmlScript::Property *prop, QQmlScript::Object *o
if (prop->value || !prop->values.isOne())
COMPILE_EXCEPTION(prop, tr("Incorrectly specified signal assignment"));
- prop->index = sig->coreIndex;
+ prop->index = propertyCacheForObject(obj)->methodIndexToSignalIndex(sig->coreIndex);
prop->core = *sig;
obj->addSignalProperty(prop);
@@ -2981,7 +2981,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
// Dynamic properties (except var and aliases)
- effectiveMethodIndex = cache->methodIndexCacheStart;
+ int effectiveSignalIndex = cache->signalHandlerIndexCacheStart;
for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
p = obj->dynamicProperties.next(p)) {
@@ -3048,15 +3048,15 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
p->name.hash());
if (p->isDefaultProperty) cache->_defaultPropertyName = propertyName.toUtf16();
cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- propertyType, effectiveMethodIndex);
+ propertyType, effectiveSignalIndex);
} else {
QString propertyName = p->name.toString();
if (p->isDefaultProperty) cache->_defaultPropertyName = propertyName;
cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- propertyType, effectiveMethodIndex);
+ propertyType, effectiveSignalIndex);
}
- effectiveMethodIndex++;
+ effectiveSignalIndex++;
VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
(vmd->propertyData() + vmd->propertyCount)->propertyType = vmePropertyType;
@@ -3084,15 +3084,15 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
p->name.hash());
if (p->isDefaultProperty) cache->_defaultPropertyName = propertyName.toUtf16();
cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- QMetaType::QVariant, effectiveMethodIndex);
+ QMetaType::QVariant, effectiveSignalIndex);
} else {
QString propertyName = p->name.toString();
if (p->isDefaultProperty) cache->_defaultPropertyName = propertyName;
cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- QMetaType::QVariant, effectiveMethodIndex);
+ QMetaType::QVariant, effectiveSignalIndex);
}
- effectiveMethodIndex++;
+ effectiveSignalIndex++;
}
// Alias property count. Actual data is setup in buildDynamicMetaAliases
@@ -3147,7 +3147,7 @@ bool QQmlCompiler::buildDynamicMetaAliases(QQmlScript::Object *obj)
QQmlPropertyCache *cache = obj->synthCache;
char *cStringData = cache->_dynamicStringData.data();
- int effectiveMethodIndex = cache->methodIndexCacheStart + cache->propertyIndexCache.count();
+ int effectiveSignalIndex = cache->signalHandlerIndexCacheStart + cache->propertyIndexCache.count();
int effectivePropertyIndex = cache->propertyIndexCacheStart + cache->propertyIndexCache.count();
int effectiveAliasIndex = 0;
@@ -3264,12 +3264,12 @@ bool QQmlCompiler::buildDynamicMetaAliases(QQmlScript::Object *obj)
p->name.hash());
if (p->isDefaultProperty) cache->_defaultPropertyName = propertyName.toUtf16();
cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- type, effectiveMethodIndex++);
+ type, effectiveSignalIndex++);
} else {
QString propertyName = p->name.toString();
if (p->isDefaultProperty) cache->_defaultPropertyName = propertyName;
cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- type, effectiveMethodIndex++);
+ type, effectiveSignalIndex++);
}
}
@@ -3821,7 +3821,7 @@ QQmlCompiler::signal(QQmlScript::Object *object, const QHashedStringRef &name, b
d = property(object, propName, notInRevision);
if (d)
- return cache->method(d->notifyIndex);
+ return cache->signal(d->notifyIndex);
}
return 0;