I componenti devono avere esattamente un elemento figlio
Questa categoria di avviso viene indicata da qmllint come " [component-children-count] ".
I componenti devono avere esattamente un elemento figlio
Cosa è successo?
Un componente ha un numero errato di elementi figli. Deve averne esattamente uno.
Perché è un problema?
Il componente radice del file non potrà essere istanziato e causerà un errore in fase di esecuzione.
Esempio
Component {
Rectangle {
width: 50
height: 50
color: "red"
}
Rectangle {
width: 50
height: 50
color: "blue"
}
}Per risolvere questo avviso, assicurati che il componente abbia esattamente un figlio. Se è vuoto, aggiungi un figlio. Se ne contiene più di uno, rimuovi i figli in eccesso oppure raggruppali in un unico figlio di primo livello del componente.
© 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.