Fonction utilisée avant sa déclaration
Cette catégorie d'avertissement est orthographiée [function-used-before-declaration] par qmllint.
Cette catégorie est désactivée par défaut.
Utilisation d'une fonction avant sa déclaration
Qu'est-ce qui s'est passé ?
Vous avez appelé une fonction ou utilisé son nom avant que la fonction ne soit déclarée.
Pourquoi est-ce mauvais ?
Cela rend le code plus difficile à lire et peut prêter à confusion.
Notez que la fonction est rendue disponible avant sa déclaration grâce au hoisting.
Exemple
import QtQuick Item { function f() { g(42) function g() { return 42; } } }
Pour corriger cet avertissement, déplacez la déclaration avant l'utilisation.
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.