このページでは

列挙型キーの大文字小文字

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

列挙型のキーが小文字で始まっている

何が起きたのか?

列挙型に、小文字で始まるキーが含まれています。

なぜ問題なのか?

検索を行う際に曖昧さが生じる可能性があります。列挙型のキーは、シングルトンやアタッチされたオブジェクトのプロパティと区別するために、大文字で始まる必要があります。この規約に従わないと、予期しない結果につながる可能性があります。

例

// Properties.qml
import QtQuick

Item {
    enum Color { red, green, blue }
}
// Main.qml
import QtQuick

Item {
    // This lookup could be interpreted as a property lookup on a Singleton or attached object.
    property int i: Properties.green
}

この警告を解消するには、キーの名前を変更して大文字で始まるようにしてください。

// Properties.qml
import QtQuick

Item {
    enum Color { Red, Green, Blue }
}
// Main.qml
import QtQuick

Item {
    // No ambiguity for the user or the QML engine, this is an enum lookup.
    property int i: Properties.Green
}

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