Auf dieser Seite

Verwirrende Ausdrucksanweisung

Diese Warnkategorie wird von qmllint als „ [confusing-expression-statement] “ bezeichnet.

Die Ausdrucksanweisung hat keine offensichtliche Wirkung

Was ist passiert?

Sie haben eine Ausdrucksanweisung verwendet, die keine offensichtliche Auswirkung hat.

Warum ist das schlecht?

Sie erschwert das Lesen des Codes und kann zu Verwirrung führen. In der Regel deutet dies darauf hin, dass das Ergebnis eines Ausdrucks ignoriert wurde.

Die Ausdrucksanweisung wird in Bytecode kompiliert und zur Laufzeit ausgewertet, obwohl sie keine Auswirkung hat.

Beispiel

import QtQuick

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

Um diese Warnung zu beheben, entfernen Sie den Ausdruck ohne Auswirkung oder verwenden Sie das Ergebnis des Ausdrucks.

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.