Las enumeraciones no son tipos
qmllint escribe esta categoría de advertencia como « [enums-are-not-types] ».
Las enumeraciones de QML no son tipos
¿Qué ha pasado?
Has utilizado un nombre de enumeración dentro de una anotación de tipo.
¿Por qué es un error?
Un nombre de enumeración no es un tipo y, por lo tanto, no se puede utilizar en una anotación de tipo. Las herramientas de QML no pueden utilizar la anotación de tipo: el compilador no puede compilar este método a C++ y qmllint tampoco QML Language Server tampoco puede 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, sustituye el nombre de la enumeración en la anotación de tipo por el tipo subyacente, como ` int ` si el tipo subyacente necesita como máximo 32 bits, o, en caso 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.