In questa pagina

Voci di enumerazione duplicate

Questa categoria di avvisi viene indicata da qmllint con il nome " [duplicate-enum-entries] ".

La chiave X dell'enumerazione è già stata dichiarata

Cosa è successo?

Un enum contiene due voci identiche.

Perché è un problema?

La stessa chiave è associata a più valori. Non è chiaro quale verrà utilizzato.

Esempio

import QtQuick

Item {
    enum E { A = 0, B = 1, C = 2, A = 3 }
}

Per risolvere questo avviso, rimuovere o rinominare le voci duplicate dell'enumerazione:

import QtQuick

Item {
    enum E { A = 0, B = 1, C = 2, D = 3 }
}

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