Evalúa
Esta categoría de advertencia se escribe [eval] por qmllint.
No utilice eval
¿Qué ha ocurrido?
Has usado eval en tu código.
¿Por qué es malo?
El método eval es lento y potencialmente peligroso. eval ejecuta su argumento como si fuera su propio script JavaScript, lo que añade cierta sobrecarga a la ejecución. El argumento pasado a eval es potencialmente un vector para ataques de ejecución remota de código.
Ejemplo
import QtQuick Item { function f() { let myString = "x", myObject = { x: 10 }, value = eval("myObject." + myString); } }
Para corregir esta advertencia, reescriba el código de modo que no contenga ninguna llamada a eval.
import QtQuick Item { function f() { let myString = "x", myObject = { x: 10 }, value = myObject[myString]; } }
© 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.