コンポーネントは正確に1つの子を持たなければならない
この警告カテゴリのスペルは[component-children-count] です。
コンポーネントは正確に1つの子を持たなければならない
何が起こりましたか?
コンポーネントの子の数が間違っています。正確に1つでなければなりません。
なぜ悪いのですか?
このファイルのルートコンポーネントはインスタンス化できず、実行時にエラーになります。
例
Component { Rectangle { width: 50 height: 50 color: "red" } Rectangle { width: 50 height: 50 color: "blue" } }
この警告を修正するには、コンポーネントにちょうど1つの子があることを確認してください。子コンポーネントが空の場合は、子コンポーネントを追加します。複数の子コンポーネントがある場合は、余分な子コンポーネントを削除するか、子コンポーネントを1つのトップレベルの子コンポーネントにまとめます。
© 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.