Thread: QML question(s)
View Single Post
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#1
A QML newbie here. The title is deliberately vague to allow continuing in the future with different QML related questions in the same thread.

To start it off...

I have a layout that changes depending on some external parameter, for example a screen orientation.
For example:
Code:
Grid {
  id: myGrid
  ...

  Rectangle {
    id: myRectangle1
    ...
  }

  Rectangle {
    id: myRectangle2
    ...
  }

  Rectangle {
    id: myRectangle3
    ...
  }
}
I also have another element in a completely different module that I want to anchor to one of the elements in my layout, e.g. myRectangle3 in the above example. Remember it can move around.
How do I do it?

A simple and naive solution below does not work:
Code:
Rectangle {
  id: myOtherRectangle
  anchorItem: myGrid.myRectangle3
  ...
}
I can anchor to myGrid but not to myGrid.myRectangle3. I am sure there is a simple solution that I am missing. I tried RTFM but if anything, it did my head in even more.
__________________
Русский военный корабль, иди нахуй!
 

The Following 2 Users Say Thank You to pichlo For This Useful Post: