QML question(s)
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 { How do I do it? A simple and naive solution below does not work: Code:
Rectangle { |
Re: QML question(s)
I may be able to help, but need some more details.
you say that those two parts being in two "completely differents" modules. what kind of separation is there between them (parents, childrens, separate files....) I am not sure where you found this anchoritem properties (no computer at hand...). I usually use the bunch of anchors.* properties you can find in this doc : http://doc.qt.io/qt-5/qml-qtquick-item.html there are several kind of anchors and dedicated properties for each. anchors.fill for exemple sets all sides to match another item, but you can also align only some sides or the vertical and horizontal center as you wish. maybe explain what you need the anchored item do relative to the target (fill it, center in it, right align...). |
Re: QML question(s)
in grid:
Code:
property alias rect1: myRectangle1 Code:
anchor.left: grid.rect1.left |
Re: QML question(s)
@Zeta,
myGrid and myOtherRectangle are siblings. I found anchorItem in some other source where I took the inspiration from. I did not find it myself. @coderus, Thanks. I had tried something similar but that did not work either. Apparently you can only anchor to a parent or a sibling. myGrid is a siblibg, myGrid.rect1 is not. Never mind, I think I figured it out. I need to refactor the code at a higher level. I could write more details when I get back to a PC. |
Re: QML question(s)
Quote:
Code:
QML Notification: Cannot anchor to an item that isn't a parent or sibling. |
Re: QML question(s)
Quote:
|
All times are GMT. The time now is 19:36. |
vBulletin® Version 3.8.8