このページについて

紛らわしい式

この警告カテゴリは、qmllint によって「[confusing-expression-statement] 」と表記されます。

式文に明らかな効果が見られない

何が起きたのか?

明らかな効果のない式文を使用しました。

なぜ問題なのか?

コードの可読性が低下し、混乱を招く恐れがあります。通常、これは式の結果が無視されたことを示しています。

式文は、たとえ何の効果も持たないにもかかわらず、バイトコードにコンパイルされ、実行時に評価されます。

例

import QtQuick

Item {
    function add(a: int, b: int) : int {
        a + b
    }
}

この警告を解消するには、効果のない式を削除するか、式の結果を使用してください。

import QtQuick

Item {
    function add(a: int, b: int) : int {
        return a + b
    }
}

© 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.