Função usada antes de sua declaração
Essa categoria de aviso é denominada “ [function-used-before-declaration] ” pelo qmllint.
Essa categoria está desativada por padrão.
Uso da função antes de sua declaração
O que aconteceu?
Você chamou uma função ou usou seu nome antes que a função fosse declarada.
Por que isso é ruim?
Isso torna o código mais difícil de ler e pode causar confusão.
Observe que a função fica disponível antes de sua declaração devido ao hoisting.
Exemplo
import QtQuick
Item {
function f() {
g(42)
function g() { return 42; }
}
}Para corrigir esse aviso, mova a declaração para antes do uso.
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.