缺少属性
此警告类别由 qmllint 拼写为[missing-property]
。
无法为不存在的默认属性赋值
发生了什么?
你将一个对象赋值给了一个不存在的默认属性。
为什么会这样?
QML Runtime 引擎不能在运行时分配这个对象。
示例
要修复此警告,请指定您要绑定的属性,或者,如果您是该类型的作者,请将一个属性标记为默认:
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 Runtime 引擎不能在运行时分配这个表达式。
示例
要修复此警告,请删除绑定或更正可能的错字:
未在类型上找到成员
发生了什么?
你在字段成员表达式中访问了一个 QML 工具找不到的成员。
字段成员表达式是someId.someProperty
形式的表达式。
为什么会这样?
QML 工具找不到这个成员,QML 引擎可能也找不到。
示例
要修复此警告,可删除绑定或纠正可能的错字:
© 2025 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.