プロパティの欠落
この警告カテゴリは、qmllint では「[missing-property] 」と表記されます。
存在しないデフォルトプロパティへの代入ができない
何が起きたのですか?
存在しないデフォルトプロパティにオブジェクトを代入しました。
なぜこれが問題なのでしょうか?
QML エンジンは、実行時にこのオブジェクトを代入することができません。
例
この警告を解消するには、バインドしたいプロパティを指定するか、その型の作成者である場合は、プロパティをデフォルトとしてマークしてください:
import QtQuick
Item {
component MyType: QtObject { property Item myItem; }
MyType {
myItem: Item {}
}
component AlternativeMyType: QtObject { default property Item myItem; }
AlternativeMyType {
Item {} // bound to myItem via default property
}
}プロパティが存在しません
何が起きたのですか?
存在しないプロパティに式を割り当てました。
なぜ問題になるのか?
QML エンジンは、実行時にこの式を代入することができません。
例
この警告を解消するには、バインディングを削除するか、入力ミスがあれば修正してください:
型にメンバーが見つかりません
何が起きたのですか?
フィールドメンバ式内で、QMLツールによって見つけることができないメンバにアクセスしました。フィールドメンバ式とは、someId.someProperty という形式の式のことです。
そのメンバは、たとえば入力ミスが原因で、そもそも存在しない可能性があります。あるいは、実行時には存在しても(常に存在する特定のサブタイプ上に存在するため)、静的に宣言された型上には存在しない場合もあります。
なぜ問題になるのか?
QMLツールはこのメンバを見つけられないため、「定義へ移動」や自動補完などの機能が動作しなくなります。 実行時に、そのメンバが実際に存在しない場合、エラーが発生したり、誤った結果が返されたりすることがあります。実行時にそのメンバが常に存在する場合、エラーは発生しませんが、その場合でも、最適化が行われないことにより、パフォーマンスの低下が生じる可能性があります。
例
プロパティが実際には存在しない
この警告を修正するには、バインディングを削除するか、タイプミスがあれば修正してください:
プロパティは存在するが、型が十分に具体的ではない
import QtQuick
import QtQuick.Controls.Basic
Item {
component Message : Item {
required property string sender
required property string text
}
ListView {
id: messageView
delegate: Message {}
}
Button {
text: "Reply to %1".arg(messageView.currentItem.sender) // not ok
}
}この警告を修正するには、読み込んだオブジェクトをより具体的な型にキャストします:
import QtQuick
import QtQuick.Controls.Basic
Item {
component Message : Item {
required property string sender
required property string text
}
ListView {
id: messageView
delegate: Message {}
}
Button {
text: "Reply to %1".arg((messageView.currentItem as Message).sender) // now ok
}
}この例では、messageView のcurrentItem プロパティの宣言型はItem ですが、この型にはsender プロパティがありません。sender はMessage でのみ定義されています。ただし、currentItem には常にMessage が含まれていることがわかっているため、型アサーションを使用してcurrentItem をMessage にキャストできます。
© 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.