プロパティの欠落
この警告カテゴリのスペルは[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ツールはこのメンバを見つけることができません。つまり、go-to-definitionやオートコンプリートのような機能が動作しません。実行時に、そのメンバが本当に存在しない場合、エラーが発生したり、正しくない結果が得られるかもしれません。実行時にメンバが常に存在する場合はエラーは発生しませんが、その場合でも最適化の失敗によるパフォーマンス・コストが発生する可能性があります。
例
プロパティが実際には存在しません
この警告を修正するには、バインディングを削除するか、タイプミスを修正してください:
プロパティは存在するが、型が十分正確でない
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.