Virgule

Cette catégorie d'avertissement est orthographiée [comma] par qmllint.

Ne pas utiliser d'expressions avec virgule

Qu'est-ce qui s'est passé ?

Une expression JavaScript de type virgule a été utilisée en dehors d'une boucle for.

Pourquoi est-ce mauvais ?

Les expressions à virgule réduisent la lisibilité du code et masquent les effets de bord.

Exemple

import QtQuick

Item {
    Component.onCompleted: init(config, true), enableLogging(categories), run(1000) // millis
}

Pour corriger cet avertissement, remaniez le code afin d'utiliser des instructions distinctes pour chaque opération. De cette manière, chaque effet secondaire est explicite au lieu de se produire dans le cadre d'une autre opération sans rapport :

import QtQuick

Item {
    Component.onCompleted: {
        init(config, true)
        enableLogging(categories)
        run(1000) // millis
    }
}

© 2025 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.