Tipo restringido
Esta categoría de advertencia se escribe [restricted-type] por qmllint.
No se puede acceder a un enum sin ámbito desde aquí
¿Qué ha ocurrido?
Has accedido al valor de un enum definido en C++ por su nombre de tipo enum.
¿Por qué es malo?
No se puede acceder a las sumas definidas en C++ por su nombre de tipo. Estarán indefinidos en tiempo de ejecución.
Ejemplo
donde MyClass se define como
class MyClass: public QObject { Q_OBJECT QML_ELEMENT public: enum Hello { World }; Q_ENUM(Hello); ... };
Para corregir esta advertencia, elimine el nombre de tipo enum innecesario de su uso QML:
Si usted es el autor de la enum, también puede modificar la definición de la enum para utilizar una clase enum en lugar de cambiar el código QML:
class MyClass: public QObject { Q_OBJECT QML_ELEMENT public: enum class Hello { World }; Q_ENUM(Hello); ... };
Nota: Puede encontrar más información sobre el registro de tipos enum aquí.
© 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.