[Qt-qml] Apply Transform to Item in onChildrenChanged?

Charley Bay charleyb123 at gmail.com
Fri Oct 22 01:36:48 CEST 2010


I wrote my own "layout" type class by hooking
into onChildrenChanged which is triggered on
parent changed, and it works great:

Item {
    id: myItem
     onChildrenChanged: {
      myItem.myUpdateChildrenPlacement()
     }

     function myUpdateChildrenPlacement() {
         for(var i= 0; i < myItem.children.length; ++i) {
          myItem.children[i].x = 13;
          myItem.children[i].y = 42;

         // HOW TO APPLY A TRANSFORM? LIKE:
//NOT WORK:         myItem.children[i].translate += Rotation { ...}
         }
     }
}

I know the "translate" is read-only, and that you would
typically define the Rotation{} when you defined the
(child) item.

However, in this case, I want my "parent layout item"
to apply the Rotation{} to a previously constructed Item{}.

...Suggestions?  (I assume this is easy to do, I'm just
not thinking about it correctly?)

Thanks!

--charley



More information about the Qt-qml mailing list