[Qbs] Language Proposal: A generic `Item{}` for classifying bindable objects.

Christian Kandeler christian.kandeler at qt.io
Mon Sep 5 13:35:19 CEST 2022

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 

> /* 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.


More information about the Qbs mailing list