QML Lint 警告和错误

下面是所有 QML Lint 警告和错误信息的概览。

Alias cycle

[alias-cycle] 别名属性是别名循环的一部分。

Attached property reuse

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

Cannot access singleton as a property of an object

[access-singleton-via-object(通过对象访问单例)] 访问单例不正确。

Comma

[逗号] 不要使用逗号表达式。

Component is missing a required property

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

Components must have exactly one child

[组件-子节点数] 一个组件的子节点数错误。

Confusing expression statement

[confusing-expression-statement] 表达式语句混乱。

Confusing minuses

[confusing-minuses] 表达式语句混乱。

Confusing pluses

[confusing-pluses] 混淆的长句。

Context properties

[使用了上下文属性。

Deprecated

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

Do not use void in expressions

[void] 使用了 void 表达式。

Duplicate Imports

[重复导入] 重复导入。

Duplicate bindings

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

Duplicate enum entries

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

Duplicate id

[syntax.duplicate-ids] id 不唯一。

Duplicate inline components

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

Duplicated name

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

Enum declared outside the root element

[non-root-enum] 在根元素之外声明了一个枚举。

Enum entry matches enum

[enum-entry-matches-enum] 枚举项的命名应与枚举本身不同。

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 有引号。

Import file selector

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

Incompatible type

[incompatible-type] 在不兼容的类型上使用了对象、值或表达式。

Inheritance cycle

[继承循环] 一个组件从自身继承。

Invalid qmllint directives

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

Literal constructor

[literal-constructor] 不要使用函数作为构造函数。

Loose equality comparison type coercion

[equality-type-coercion] 使用松散的相等比较运算符可能会胁迫值。

Missing enum entry

[missing-enum-entry] 在声明中缺少枚举值。

Missing property

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

Missing type

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

Multiline strings

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

Non-list property

[非列表属性] 为一个非列表属性分配了多个值。

Prefer non-var properties

[prefer-non-var-properties] 优先选择非变量属性,而不是变量属性。

Quick: Attached property type

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

Readonly property

[read-only-property] 写入了一个只读属性。

Recursion depths errors

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

Redundant Optional Chaining

[冗余可选链式查找] 某些可选链式查找可能是非可选的。

Restricted type

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

Signal handler parameters

[信号处理器参数] 信号处理器不符合信号类型。

Stale property read

[stale-property-read] 读取非常数和不可注属性。

Syntax

[语法] 各种语法错误。

Top level component

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

Uncreatable type

[uncreatable-type] 无法创建的类型。

Unintentional empty block

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

Unqualified

[unqualified] 在没有 id 的情况下访问外层作用域。

Unreachable code

[无法访问代码] 某些指令无法访问。

Unresolved alias

[unresolved-alias]未找到属性别名的属性。

Unresolved type

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

Unterminated non-empty case block

[unterminated-case] 一个非空的情况块未被终止。

Unused imports

[unused-imports] 未使用导入模块的类型。

Use proper function

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

Var used before declaration

[var-used-before-declaration]JavaScript 变量在声明之前被使用。

Warn about using assignment in conditions

[在条件中赋值] 在条件中使用了赋值语句。

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.