Preferir propiedades no var
Esta categoría de advertencia se escribe [prefer-non-var-properties] por qmllint.
Preferir tipo más específico sobre var
¿Qué ha ocurrido?
Has definido una propiedad en QML con el tipo var en lugar de uno más específico, como int o string por ejemplo.
¿Por qué es malo?
Esto afecta a la legibilidad del código y las herramientas QML no pueden aplicar optimizaciones de tipo específicas.
Debe evitar utilizar var como tipo de propiedad para propiedades que siempre tengan el mismo tipo. Para evitar falsos positivos, qmllint sólo advierte sobre propiedades readonly con bindings simples. En otros casos, puede que no sea capaz de distinguir las propiedades que tienen que ser var, porque necesitan contener múltiples tipos, de las propiedades que siempre contienen el mismo tipo.
Ejemplo
Para corregir esta advertencia, sustituya var por el tipo específico.
© 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.