- Qt 6.12
- Qt Qml
- QML Lint Warning and Errors
- Id shadows member
- Qt 6.12.0 Reference Documentation

# Id shadows member

This warning category is spelled `[id-shadows-member]` by qmllint.

## Id shadows property, method or signal

### What happened?

An id is potentially shadowing a property, method, or signal in the same context.

### Why is that bad?

You can't access the property, method, or signal by its unqualified name anymore. Code that used to do so will silently access the id instead, potentially leading to hard-to-spot bugs.

### Example

     import QtQuick

     Item {
         Item { id: helloWorld }
         property int helloWorld: 42
         Component.onCompleted: console.log(helloWorld) // not 42
     }

To fix this warning, rename the id or the shadowed member.

     import QtQuick

     Item {
         Item { id: helloWorldId }
         property int helloWorld: 42
         Component.onCompleted: console.log(helloWorld) // now 42
     }