QML Previous selector
-
If you would like to.. let's say.. set a margin on the left side of an object, you would need to give every object a unique identifier and select objects using this identifier:
@Rectangle { id: rect1; ... }
Rectangle { id: rect2; anchors.left: rect1.right; anchors.leftMargin: 5; ... }@But actually it would be much more comfortable to have an automatic selector for this, just like the "parent" selector identifies the object's parent object, the "previous" selector should select the previously declared object, don't you think so? For example:
@Rectangle { ... }
Rectangle { anchors.left: previous.right; anchors.leftMargin: 5; ... }@This could indeed cause a problem if there's no previous object though...
Can you somehow do this in QML? -
Hi and welcome to devnet,
You're on the wrong channel to discuss such things. You should rather post this question on the interest mailing list. You'll find Qt's developers/maintainers (this forum is more user oriented) Don't forget to subscribe first
-
[quote author="SGaist" date="1403380452"]Hi and welcome to devnet,
You're on the wrong channel to discuss such things.[/quote]
I was asking myself whether it's possible in QML right now, isn't it?
-
Hi,
Selecting the "previous" object not currently possible in QML.
I'm not sure this feature makes sense however, because QML has a declarative structure and the order in which you declare your components should not matter.
Anyway, it looks like what you need is a "layout manager":http://qt-project.org/doc/qt-5/qtquicklayouts-index.html