Con
Questa categoria di avviso viene indicata da qmllint come " [with] ".
Con le istruzioni
Cosa è successo?
È stata utilizzata l'istruzione JavaScript " with ".
Perché è un problema?
Le istruzioni "with" potrebbero causare falsi positivi durante l'analisi di identificatori non qualificati. Inoltre, le istruzioni " with " sono contrassegnate come deprecate dall'ultimo standard JavaScript.
Esempio
import QtQuick
Item {
function f() {
with (Math) {
return PI
}
}
}Per risolvere questo avviso, sostituisci l'istruzione ` with ` con una proprietà di destrutturazione:
import QtQuick
Item {
function f() {
const { PI } = Math;
return PI
}
}Nota: quipuoi trovare altre idee per la sostituzione.
© 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.