Les composants doivent avoir exactement un enfant
Cette catégorie d'avertissement est orthographiée [component-children-count] par qmllint.
Les composants doivent avoir exactement un enfant
Qu'est-ce qui s'est passé ?
Un composant n'a pas le bon nombre d'enfants. Il doit avoir exactement un enfant.
Pourquoi est-ce mauvais ?
Le composant racine du fichier ne sera pas instanciable et provoquera une erreur à l'exécution.
Exemple
Component { Rectangle { width: 50 height: 50 color: "red" } Rectangle { width: 50 height: 50 color: "blue" } }
Pour corriger cet avertissement, assurez-vous que le composant a exactement un enfant. S'il est vide, ajoutez-lui un enfant. S'il en contient plusieurs, supprimez les enfants excédentaires ou intégrez les enfants dans un seul enfant de premier niveau du composant.
© 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.