Recognize QML slots and register them as uses of their corresponding signal

Review Request #118596 - Created June 6, 2014 and submitted

Information
Denis Steckelmacher
kdev-qmljs
master
Reviewers
kdevelop
When the declaration corresponding to a name is being looked for, and the name is "onXXX", declarations named "XXX" are also returned if they are signals. This allows UseBuilder to register "onClicked" as being an use of the "clicked" signal.

This patch is very general and modifies directly getDeclaration(). This has the advantage that the search logic can be used everywhere (for instance, DeclarationBuilder will soon be able to expose the parameters of a signal to its slot), but getDeclarations() must be very careful not to return an unexpected declaration. For instance, if the user, in a Javascript file, declares an "line" variable, "online" must not be an use of "line". This is done by ensuring that the returned declaration, when "on" has been stripped, is a QML signal.
Two unit tests have been added: one ensures that "onDataChanged" is an use of "dataChanged", and one ensures that "online" is not an use of "line" in Javascript.
Sven Brauch
Denis Steckelmacher
Sven Brauch
Commit Hook
This review has been submitted with commit 7360306d43e81e9751bce64ba2d7becd61149e3f by Denis Steckelmacher to branch master.
Denis Steckelmacher
Review request changed

Status: Closed (submitted)

Loading...