En esta página

Con

Esta categoría de advertencia se escribe [with] por qmllint.

Con declaraciones

¿Qué ha ocurrido?

Se ha utilizado la sentencia JavaScript with.

¿Por qué es malo?

Las sentencias With pueden provocar falsos positivos al analizar identificadores no cualificados. 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 corregir esta advertencia, sustituya la sentencia with por una propiedad de desestructuración:

import QtQuick

Item {
    function f() {
        const { PI } = Math;
        return PI
    }
}

Nota: Puede 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.