缺少枚举项
qmllint 将此警告类别拼写为“[missing-enum-entry] ”。
不是枚举条目
发生了什么?
您使用了一个不存在的枚举值。
为什么这样不好?
该枚举值在运行时将被定义为未定义。
示例
// Main.qml
import QtQuick
Item {
enum Hello { World }
Component.onCompleted: function() {
console.log(Main.Hello.Wordl, Main.Hello.Moon) // both Wordl and Moon are incorrect
}
}要解决此警告,请更正可能的拼写错误,或在定义中添加缺失的枚举值:
// Main.qml
import QtQuick
Item {
enum Hello { World, Moon }
Component.onCompleted: function() {
console.log(Main.Hello.World, Main.Hello.Moon) // both correct now
}
}© 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.