このページについて

重複する列挙型エントリ

この警告カテゴリは、qmllint では「[duplicate-enum-entries] 」と表記されます。

列挙型のキー X はすでに宣言されています

何が起きたのか?

列挙型に 2 つの同一のエントリが含まれています。

なぜ問題なのでしょうか?

同じキーが複数の値に関連付けられています。どの値が使用されるのかが不明確です。

例

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 }
}

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