Os componentes devem ter exatamente um elemento filho
Essa categoria de aviso é chamada de “ [component-children-count] ” pelo qmllint.
Os componentes devem ter exatamente um filho
O que aconteceu?
Um componente possui um número incorreto de filhos. Ele deve ter exatamente um.
Por que isso é ruim?
O componente raiz do arquivo não poderá ser instanciado e causará um erro em tempo de execução.
Exemplo
Component {
Rectangle {
width: 50
height: 50
color: "red"
}
Rectangle {
width: 50
height: 50
color: "blue"
}
}Para corrigir esse aviso, certifique-se de que o componente tenha exatamente um filho. Se estiver vazio, adicione um filho a ele. Se contiver vários, remova os filhos em excesso ou agrupe-os em um único filho de nível superior do 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.