Fehlender enum-Eintrag

Diese Warnkategorie wird von qmllint [missing-enum-entry] geschrieben.

Ist kein Eintrag von enum

Was ist passiert?

Sie haben einen enum-Wert verwendet, der nicht existiert.

Warum ist das schlecht?

Der enum-Wert wird zur Laufzeit undefiniert sein.

Beispiel

// Main.qml
import QtQuick

Item {
    enum Hello { World }

    Component.onCompleted: function() {
        console.log(Main.Hello.Wordl, Main.Hello.Moon) // both Wordl and Moon are incorrect
    }
}

Um diese Warnung zu beheben, korrigieren Sie einen möglichen Tippfehler oder fügen Sie den fehlenden Enum-Wert in die Definition ein:

// Main.qml
import QtQuick

Item {
    enum Hello { World, Moon }

    Component.onCompleted: function() {
        console.log(Main.Hello.World, Main.Hello.Moon) // both correct now
    }
}

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