On 9/2/22 04:13, hug-animals via Qbs wrote:
Product {
/* Syntax 1 */
property var feed: Item {
property string hobo
property var seed: Item {
property string chuck
}
}

Probably the most sensible of the variants.

Perhaps also:

property MyItem prop

where MyItem is defined as an Item subtype somewhere.

Somewhat related QML feature: inline components (https://www.qt.io/blog/new-qml-language-features-in-qt-5.15).

/* In use */
import "Sneed.qbs" as Sneed

Sneed {
feed.hobo : "Hobo"
feed.seed.chuck: "Chuck"
Access into nested items is afaik explicitly not supported in QML as it breaks encapsulation, but if I understand correctly, your Items are basically just type-safe JS objects.
Is this important?Yes, insofar as it reduces namespace pollution in a practical 
way that is currently impossible.
Playing devil's advocate: Why has no one needed this in QML so far?
Potential Drawbacks:- This does depart a bit from QML syntax rules.

You'd definitely need to adapt the parser (which is currently reused as-is from QML), as well as the evaluation machinery. Difficult to say how much work that would be.


Christian
_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs

Reply via email to