En esta página

Los Enums no son tipos

Esta categoría de advertencia se escribe [enums-are-not-types] por qmllint.

Las enumeraciones QML no son tipos

¿Qué ha ocurrido?

Ha utilizado un nombre de enumeración dentro de una anotación de tipo.

¿Por qué es malo?

Un nombre de enumeración no es un tipo y por lo tanto no puede ser usado en una anotación de tipo. Las herramientas QML no son capaces de utilizar la anotación de tipo: el compilador no puede compilar este método a C++ y qmllint así como QML Language Server no pueden analizar este método.

Ejemplo

// Main.qml
import QtQuick

Item {
    enum HelloWorld { Hello, World }
    function f(e: Main.HelloWorld): bool {
        return e == World
    }
}

Para solucionar esta advertencia, sustituya el nombre del enum en la anotación de tipo por el tipo subyacente, como int si el tipo subyacente necesita como máximo 32 bits, o de lo contrario double, por ejemplo.

import QtQuick

Item {
    enum HelloWorld { Hello, World }
    function f(e: int): bool {
        return e === World
    }
}

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