Membro di Id shadows
Questa categoria di avviso viene indicata da qmllint come " [id-shadows-member] ".
Ombra su proprietà, metodo o segnale
Cosa è successo?
Un ID sta potenzialmente oscurando una proprietà, un metodo o un segnale nello stesso contesto.
Perché è un problema?
Non è più possibile accedere alla proprietà, al metodo o al segnale tramite il suo nome non qualificato. Il codice che in precedenza lo faceva accederà silenziosamente all'ID, causando potenzialmente bug difficili da individuare.
Esempio
import QtQuick
Item {
Item { id: helloWorld }
property int helloWorld: 42
Component.onCompleted: console.log(helloWorld) // not 42
}Per risolvere questo avviso, rinominare l’ID o il membro oscurato.
© 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.