QML Lint 警告和错误

以下是所有 QML Lint 警告和错误消息的概述。

Alias cycle

[alias-cycle] 别名属性属于别名循环。

Attached property reuse

[attached-property-reuse] 附加类型被初始化了多次。

Block scope var declaration

[var-used-in-block-scope] 在代码块作用域内使用 var 声明了变量。

Cannot access singleton as a property of an object

[access-singleton-via-object] 访问单例的方式不正确。

Comma

[comma] 请勿使用逗号表达式。

Component is missing a required property

[required] 组件的 required 属性未被绑定。

Components must have exactly one child

[component-children-count] 组件的子元素数量有误。

Confusing expression statement

[confusing-expression-statement] 表达式语句令人困惑。

Confusing minuses

[confusing-minuses] 令人困惑的减号。

Confusing pluses

[confusing-pluses] 令人困惑的加号。

Context properties

[context-properties] 使用了上下文属性。

Deprecated

[deprecated] 使用了已弃用的属性或类型。

Do not use void in expressions

[void] 使用了 void 表达式。

Duplicate Imports

[duplicate-import] 导入重复。

Duplicate bindings

[属性绑定重复] 某个属性被绑定多次。

Duplicate enum entries

[duplicate-enum-entries] 枚举键 X 已被声明。

Duplicate id

[syntax.duplicate-ids] 某个标识符不唯一。

Duplicate inline components

[duplicate-inline-components] 内联组件重复。

Duplicated name

[duplicated-name] 同一组件中多个成员共享相同名称。

Enum declared outside the root element

[非根枚举] 枚举在根元素之外被声明。

Enum entry matches enum

[enum-entry-matches-enum] 枚举条目的名称应与枚举本身不同。

Enum key case

[enum-key-case] 枚举键以小写字母开头。

Enums are not types

[enums-are-not-types] 枚举名称被用作类型注释。

Eval

[eval] 使用了 eval。

Function used before its declaration

[function-used-before-declaration] 函数在声明之前已被调用。

Id quotation

[syntax.id-quotation] 标识符包含引号。

Id shadows member

[id-shadows-member] 标识符遮蔽了成员。

Import file selector

[import-file-selector] 使用文件选择器的导入。

Incompatible type

[incompatible-type] 某个对象、值或表达式被用于不兼容的类型上。

Inheritance cycle

[inheritance-cycle] 某个组件继承自其自身。

Inline component enums

[inline-component-enums] 在内联组件内部声明了枚举。

Invalid qmllint directives

[invalid-lint-directive] qmllint 注释无效。

Literal constructor

[字面量构造函数] 请勿将函数用作构造函数。

Loose equality comparison type coercion

[equality-type-coercion] 使用宽松的相等比较运算符可能会导致值被强制转换。

Missing enum entry

[缺失枚举条目] 枚举声明中缺少枚举值。

Missing property

[missing-property] 将值绑定到不存在的属性上。

Missing type

[missing-type] 未找到绑定或别名中使用的类型。

Multiline strings

[多行字符串] 字符串跨越了多行。

Non-list property

[非列表属性] 向非列表属性赋值了多个值。

Prefer non-var properties

[prefer-non-var-properties] 优先使用非 var 属性而非 var 属性。

Property override

[property-override] 错误使用了 override、final 和 virtual 关键字。

Quick: Attached property type

[Quick.attached-property-type] 误用了 Quick 附加属性类型。

Readonly property

[read-only-property] 编写了只读属性。

Recursion depths errors

[递归深度错误] QML 语句或表达式嵌套过深。

Redundant Optional Chaining

[redundant-optional-chaining] 某些可选链式查找可能并非可选。

Renamed Type

[renamed-type] 通过未导出的名称调用了某个类型。

Restricted type

[受限类型] 访问了受限类型。

Shadow

[遮蔽] 一个成员遮蔽了另一个成员。

Signal handler parameters

[信号处理程序参数] 信号处理程序不符合信号类型的要求。

Stale property read

[过期属性读取] 读取了非常量且不可通知的属性。

Syntax

[syntax] 各种语法错误。

Top level component

[top-level-component] 根 QML 类型是一个组件。

Type is instantiated recursively

[type-instantiated-recursively] 类型正在递归实例化自身。

Uncreatable type

[无法创建的类型] 无法创建的类型。

Unintentional empty block

[unintentional-empty-block] 创建了一个空代码块,很可能是代替对象字面量。

Unqualified

[未限定] 未使用 id 访问外部作用域。

Unreachable code

[无法触及的代码] 某些指令无法被执行。

Unresolved alias

[未解析别名] 未找到属性别名的属性。

Unresolved type

[unresolved-type] 未找到已使用的类型。

Unterminated non-empty case block

[未终止-case] 一个非空的 case 代码块未被终止。

Unused imports

[未使用的导入] 导入模块中的类型未被使用。

Use proper function

[use-proper-function] 调用了可能不是函数的对象。

Var used before declaration

[变量在声明前被使用] 某个 JavaScript 变量在声明之前就被使用了。

Warn about using assignment in conditions

[assignment-in-condition] 在条件语句中使用了赋值语句。

Warnings occurred while importing

[import] 未找到所导入的模块。

With

[with] 在 QML 中强烈不建议使用 with 语句。

© 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.