Con
qmllint escribe esta categoría de advertencia como « [with] ».
Con sentencias
¿Qué ha ocurrido?
Se ha utilizado la instrucción « with » de JavaScript.
¿Por qué es un problema?
Las sentencias «with» pueden provocar falsos positivos al analizar identificadores no calificados. Además, las sentencias « with » están marcadas como obsoletas por el último estándar de JavaScript.
Ejemplo
import QtQuick
Item {
function f() {
with (Math) {
return PI
}
}
}Para solucionar esta advertencia, sustituye la instrucción ` with ` por una propiedad de desestructuración:
import QtQuick
Item {
function f() {
const { PI } = Math;
return PI
}
}Nota: Puedes encontrar más ideas de sustitución 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.