qt5-cadaques
qt5-cadaques copied to clipboard
Possibly confusing use of the term "name" in respect to object id
back-link: ch04/index.html#quick-starter
There are comments like "// name this element root" however an object's name (set via the objectName property) is separate from its id attribute.
Not a huge issue, obviously, just thought I'd point it out.
Also, you state "An element id should only be used to reference elements inside your document" but this is not entirely correct. Ids have component scope, not document scope, which can show up in surprising places (eg, in-line delegate definitions - this one in particular is problematic because of the way QML automatically "helpfully" (and that's debatable.. but certainly it's less verbose) inserts a Component { } block around an in-line delegate declaration).
The rest of that warning (about it being possible to reference ids from earlier loaded documents) is incorrect. Ids are unique within a component scope, and you cannot reference ids from a different component scope. Note that a symbol may in fact resolve to something outside of the current component scope, but if it does, it will be a property, context property, attached object property, typename, or resolvable Javascript symbol, rather than an object identifier.