Eval
この警告カテゴリは、qmllint では「[eval] 」と表記されます。
eval を使用しないでください
何が起きたのでしょうか?
コード内でeval を使用しました。
なぜ問題なのでしょうか?
eval メソッドは処理が遅く、潜在的に危険です。eval は、引数をあたかも独自の JavaScript スクリプトであるかのように実行するため、実行に一定のオーバーヘッドが生じます。eval に渡される引数は、リモートコード実行攻撃の媒介となる可能性があります。
例
import QtQuick
Item {
function f() {
let myString = "x",
myObject = {
x: 10
},
value = eval("myObject." + myString);
}
}この警告を解消するには、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.