重复的枚举项

此警告类别由 qmllint 拼写[duplicate-enum-entries]

枚举键 X 已被声明

发生了什么事?

一个枚举包含两个相同的条目。

为什么会这样?

同一个键与多个值相关联。不清楚哪个会被使用。

示例

import QtQuick

Item {
    enum E { A = 0, B = 1, C = 2, A = 3 }
}

要修复此警告,请删除或重命名重复的枚举项:

import QtQuick

Item {
    enum E { A = 0, B = 1, C = 2, D = 3 }
}

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