diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-02-24 05:06:56 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-02-24 05:06:56 (GMT) |
commit | a2a8cea2835ef24104fe784b6ce0f508cc5637c0 (patch) | |
tree | 80f6ad699172cb436c0d159472f8203fd5430ad4 /src/declarative | |
parent | 7c76abb0dc4204043bec9b6fa315f9753a7986ae (diff) | |
download | Qt-a2a8cea2835ef24104fe784b6ce0f508cc5637c0.zip Qt-a2a8cea2835ef24104fe784b6ce0f508cc5637c0.tar.gz Qt-a2a8cea2835ef24104fe784b6ce0f508cc5637c0.tar.bz2 |
Automatically connect to a notify signal if the requested signal is
in the "onFooChanged" form, even if the notify signal is not called
"fooChanged".
Task-number: QT-2783
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qdeclarativecompiler.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 0593a5d..b6ebd60 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1326,6 +1326,16 @@ int QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const QByteArr if (methodName == name) return ii; } + + // If no signal is found, but the signal is of the form "onBlahChanged", + // return the notify signal for the property "Blah" + if (name.endsWith("Changed")) { + QByteArray propName = name.mid(0, name.length() - 7); + int propIdx = mo->indexOfProperty(propName.constData()); + if (propIdx >= 0) + return mo->property(propIdx).notifySignalIndex(); + } + return -1; } |