En esta página

Miembro de Id shadows

qmllint escribe esta categoría de advertencia como « [id-shadows-member] ».

Sombra de un identificador de una propiedad, método o señal

¿Qué ha pasado?

Un identificador (id) podría estar enmascarando una propiedad, un método o una señal en el mismo contexto.

¿Por qué es un problema?

Ya no se puede acceder a la propiedad, al método o a la señal mediante su nombre sin calificar. El código que solía hacerlo accederá en su lugar al identificador de forma silenciosa, lo que puede dar lugar a errores difíciles de detectar.

Ejemplo

import QtQuick

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

Para solucionar esta advertencia, cambia el nombre del identificador o del miembro ocultado.

import QtQuick

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

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.