Unqualified Access

Unqualified Access

What happened?

A parent element was accessed without its id.

Why is this bad?

This makes the code harder to read and impedes performance.

Example

 import QtQuick

 Item {
     property int helloWorld
     Item {
         property int unqualifiedAccess: helloWorld + 1 // not ok: Unqualified access here.
     }
 }

You can fix this warning by referring to the parent object by id. If the object currently has no id, you will need to add one first.

 import QtQuick

 Item {
     id: root
     property int helloWorld
     Item {
         property int unqualifiedAccess: root.helloWorld + 1 // ok: this access is qualified now!
     }
 }

See also QML Coding Conventions - Unqualified Access.