以下の場合
この警告カテゴリは、qmllint によって「[with] 」と表記されます。
ステートメントについて
何が起きたのか?
JavaScriptのwith 文が使用されました。
なぜ問題なのでしょうか?
with 文は、修飾されていない識別子を解析する際に誤検知を引き起こす可能性があります。また、with 文は、最新の JavaScript 標準で非推奨とマークされています。
例
import QtQuick
Item {
function f() {
with (Math) {
return PI
}
}
}この警告を解消するには、with 文をデストラクチャリングプロパティに置き換えてください:
import QtQuick
Item {
function f() {
const { PI } = Math;
return PI
}
}注: その他の修正案についてはこちらをご覧ください。
© 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.