[new compiler] Fix signal handlers on own properties
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 20 Sep 2013 12:32:06 +0000 (14:32 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 20 Sep 2013 20:13:31 +0000 (22:13 +0200)
When compiling signal handler expressions we need to determine the parameters.
We first try to look up the signal in the base meta-object. For our own
QML type itself we don't have a meta-object yet and so we extract the information
about which parameters the signals have from the parsed AST's signal declarations.

For signal handlers on declared properties we need to "synthesize" the
signal (myPropertyChanged) as well, with an empty parameter list.

Change-Id: Iecfe7bc7a9979d57586cbd9434bb9eb2f38a2c7b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/compiler/qqmlcodegenerator.cpp

index 381f5bf..3d3e155 100644 (file)
@@ -1268,6 +1268,11 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
                     const QString &signalName = stringAt(signal->nameIndex);
                     customSignals.insert(signalName, signal->parameterStringList(parsedQML->jsGenerator.strings));
                 }
+
+                for (QmlProperty *property = obj->properties->first; property; property = property->next) {
+                    const QString propName = stringAt(property->nameIndex);
+                    customSignals.insert(propName, QStringList());
+                }
             }
 
             QHash<QString, QStringList>::ConstIterator entry = customSignals.find(propertyName);