I've created a couple of my own objects, container and item
Items are movable and periodically I check for some condition, let's say fot objects intersection.
If required event occurs, the object emits a signal:

Qt Code:
  1. class Container : public QQuickItem {
  2. public:
  3. void checkIntersection() {
  4. foreach (QObject *child, childItems()) {
  5. if (MyObject *obj = dynamic_cast<MyObject*>(child)) {
  6. ...
  7. if(intersected(obj,other_obj)) emit intersect(other_obj);
  8. }
  9. }
  10. }
  11. bool intersected(MyObject * obj,MyObject * other) {
  12. ...
  13. return true;
  14. }
  15. signals:
  16. intersect(MyObject * other);
  17. }
  18.  
  19. class MyObject : public QQuickItem {
  20. ...
  21. }
To copy to clipboard, switch view to plain text mode 

and QML structure for better understanding:
Qt Code:
  1. Container {
  2. MyObject {
  3. id: object1
  4. ...
  5. onIntersect: {
  6. if(other.id === "object2") { // error, id is undefined
  7. doSomething();
  8. }
  9. }
  10. }
  11. MyObject {
  12. id: object2
  13. ...
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 

As you can see, when I trying to get object property (id) I get error. I can read some properties, width or height for example, but id is inaccesible.
What I do wrong?