Commit 756e00b1 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Always generate a onXyzChanged slot.

Even if the NOTIFY signal listed for the property has a different name.

Task-number: QTCREATORBUG-3614
Change-Id: I748cddab89732acd6a56b243610be52873225064
Reviewed-on: http://codereview.qt.nokia.com/637

Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent 46e970c3
...@@ -189,12 +189,8 @@ void QmlObjectValue::processMembers(MemberProcessor *processor) const ...@@ -189,12 +189,8 @@ void QmlObjectValue::processMembers(MemberProcessor *processor) const
} }
} }
// process the meta properties // all explicitly defined signal names
for (int index = 0; index < _metaObject->propertyCount(); ++index) { QSet<QString> explicitSignals;
FakeMetaProperty prop = _metaObject->property(index);
processor->processProperty(prop.name(), propertyValue(prop));
}
// process the meta methods // process the meta methods
for (int index = 0; index < _metaObject->methodCount(); ++index) { for (int index = 0; index < _metaObject->methodCount(); ++index) {
...@@ -208,9 +204,9 @@ void QmlObjectValue::processMembers(MemberProcessor *processor) const ...@@ -208,9 +204,9 @@ void QmlObjectValue::processMembers(MemberProcessor *processor) const
} else if (method.methodType() == FakeMetaMethod::Signal && method.access() != FakeMetaMethod::Private) { } else if (method.methodType() == FakeMetaMethod::Signal && method.access() != FakeMetaMethod::Private) {
// process the signal // process the signal
processor->processSignal(methodName, signature); processor->processSignal(methodName, signature);
explicitSignals.insert(methodName);
QString slotName; QString slotName = QLatin1String("on");
slotName += QLatin1String("on");
slotName += methodName.at(0).toUpper(); slotName += methodName.at(0).toUpper();
slotName += methodName.midRef(1); slotName += methodName.midRef(1);
...@@ -219,6 +215,27 @@ void QmlObjectValue::processMembers(MemberProcessor *processor) const ...@@ -219,6 +215,27 @@ void QmlObjectValue::processMembers(MemberProcessor *processor) const
} }
} }
// process the meta properties
for (int index = 0; index < _metaObject->propertyCount(); ++index) {
FakeMetaProperty prop = _metaObject->property(index);
const QString propertyName = prop.name();
processor->processProperty(propertyName, propertyValue(prop));
// every property always has a onXyzChanged slot, even if the NOTIFY
// signal has a different name
QString signalName = propertyName;
signalName += QLatin1String("Changed");
if (!explicitSignals.contains(signalName)) {
QString slotName = QLatin1String("on");
slotName += signalName.at(0).toUpper();
slotName += signalName.midRef(1);
// process the generated slot
processor->processGeneratedSlot(slotName, engine()->undefinedValue());
}
}
if (_attachedType) if (_attachedType)
_attachedType->processMembers(processor); _attachedType->processMembers(processor);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment