コンポーネントに必須のプロパティが欠落しています
この警告カテゴリは、qmllint では「[required] 」と表記されます。
コンポーネントに必須のプロパティがありません
何が起きたのか?
コンポーネントの必須プロパティが設定されていませんでした。
なぜ問題なのでしょうか?
必須プロパティが欠落しているコンポーネントを含む QML アプリケーションは、正常に動作しません。欠落している必須プロパティが静的に検出された場合、アプリケーションはまったく起動しません。動的に作成されるコンポーネントで必須プロパティが欠落している場合、実行時にそのコンポーネントは作成されず、代わりに null となります。
例
import QtQuick
Item {
component RepeatMe: Item {
required property int index;
required property int helloWorld;
}
RepeatMe {} // not ok: required properties index and helloWorld not set
Repeater {
model: 10
RepeatMe {} // not ok: required property index set by Repeater, but not helloWorld
}
}この警告を解消するには、必須のプロパティを設定してください:
import QtQuick
Item {
component RepeatMe: Item {
required property int index;
required property int helloWorld;
}
RepeatMe {
index: 0
helloWorld: 42
} // ok: all required properties were set
Repeater {
model: 10
RepeatMe {
helloWorld: index * 2 + 1
} // ok: all required properties were set: index by the Repeater and helloWorld by the user
}
}「QML コーディング規約 - 必須プロパティ」も参照してください 。
© 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.