[Development] QTCS2019 Notes from QtQml session

André Somers andre at familiesomers.nl
Tue Nov 26 11:39:41 CET 2019

On 26/11/2019 09:34, Chris Adams wrote:
> On Mon, Nov 25, 2019 at 9:34 PM Ulf Hermann <ulf.hermann at qt.io> wrote:
>>> I think one of the biggest problems is that ID resolution crosses
>>> file boundaries. This essentially means that the ids chosen can very
>>> easily become part of the "API" of a component unless you are very
>>> vigilant to not allow that to happen.
>> Well, yes, and there is an easy way to fix this: Deprecate id lookup
>> across file scope. id lookup is actually the same as context property
>> lookup right now. That's what you're seeing there. We cannot get rid of
>> IDs, obviously, but we can restrict their use to the file context and
>> not search the whole context hierarchy.
> Could I suggest also changing the id syntax to clarify that id is not
> an object attribute?
> e.g.:
> Button id: btn { }
> or
> Button is btn { }
> or
> Button as btn { }
> are IMO better syntax than:
> Button { id: btn }
> as for the former they are clearer that the ids are attributes of the
> component scope rather than attributes of the object per-se, which is
> what is suggested by the latter.

I'd tend to agree with that one. Perhaps it could just be

Button btn { }

No "id:" "is" or "as" needed?

Still: huge change again going to affect lots of existing code...


More information about the Development mailing list