Missing "this" and "sender" pointers in Qml
It seems like using an item's id is the only way to obtain a reference to the Item (without resorting to "parent.children"):
If I have a selection of several Items that need to emit the same signal "someParent.someSignal", then inventing a new id for each item just for passing it to the signal looks a bit tedious.
To "code less", it would be nice to have something similar to the "this" pointer used in C++:
Also, there is no "sender" pointer that could be used in an Item that receives someSignal.
I hope these features are planned in some future release...
Btw, console.log(this) prints out: "[object global]" - what is that? I could not find it in the docs...
[quote author="ivoryZ" date="1354164599"]I hope these features are planned in some future release...[/quote]
You can suggest a feature on JIRA and/ or Qt development mailing list. I think this is a valid point, I miss such a feature, too.
In your example, you can probably use the mouse event in the signal:
But that is just one small, corner case.
i think that on embeded functions in the declarative objects, it is so easy has adding a preparser that creates temporary and transparent id for the functions, so that we can use this in many functions, but execution performance is equal.
Am i wrong or it is in fact this way easy for most of the cases?