このページでは

最上位コンポーネント

この警告カテゴリは、qmllint によって「[top-level-component] 」と表記されます。

QMLのトップレベル型はコンポーネントにはできません

何が起きたのか?

QML ファイルのトップレベル型として `Component ` 型を使用しました。

なぜこれが問題なのでしょうか?

QML ファイル自体ですでにコンポーネントが定義されています。Component 型をトップレベル型として使用すると、コンポーネントが別の不要なコンポーネントでラップされてしまいます。

例

import QtQuick

Component {
    Item { ... }
}

この警告を解消するには、余分な Component によるラップを削除してください:

import QtQuick

Item { ... }

© 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.