Funktion vor ihrer Deklaration verwendet
Diese Warnkategorie wird von qmllint mit [function-used-before-declaration] geschrieben.
Diese Kategorie ist standardmäßig deaktiviert.
Funktionsverwendung vor der Deklaration
Was ist passiert?
Sie haben eine Funktion aufgerufen oder ihren Namen verwendet, bevor die Funktion deklariert wurde.
Warum ist das schlecht?
Es erschwert die Lesbarkeit des Codes und kann zu Verwirrung führen.
Beachten Sie, dass die Funktion vor ihrer Deklaration durch das Hailing verfügbar gemacht wird.
Beispiel
import QtQuick Item { function f() { g(42) function g() { return 42; } } }
Um diese Warnung zu beheben, verschieben Sie die Deklaration vor die Verwendung.
import QtQuick Item { function f() { function g() { return 42; } g(42) } }
© 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.