[Development] QTCS2019 Notes from QtQml session
Chris Adams
chris.adams at qinetic.com.au
Tue Nov 26 09:34:46 CET 2019
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.
Cheers,
Chris.
More information about the Development
mailing list