Auf dieser Seite

Verwirrende Ausdrucksanweisung

Diese Warnkategorie wird von qmllint [confusing-expression-statement] geschrieben.

Expression-Anweisung hat keine offensichtliche Wirkung

Was ist passiert?

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

Warum ist das schlecht?

Es erschwert die Lesbarkeit des Codes und kann zu Verwirrung führen. Normalerweise zeigt es an, dass ein Ausdrucksergebnis ignoriert wurde.

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

Beispiel

import QtQuick

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

Um diese Warnung zu beheben, entfernen Sie den Ausdruck ohne Wirkung oder verwenden Sie das Ausdrucksergebnis.

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.