Function used before its declaration
This warning category is spelled [function-used-before-declaration] by qmllint.
This category is disabled by default.
Function usage before its declaration
What happened?
You called a function or used its name before the function was declared.
Why is that bad?
It makes the code more difficult to read and may cause confusion.
Note that the function is made available before its declaration due to hoisting.
Example
import QtQuick Item { function f() { g(42) function g() { return 42; } } }
To fix this warning, move the declaration before the usage.
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.