Componente di primo livello
Questa categoria di avviso viene indicata da qmllint come " [top-level-component] ".
Un tipo di primo livello in QML non può essere un componente
Cosa è successo?
Hai utilizzato il tipo " Component " come tipo di primo livello nel tuo file QML.
Perché è un errore?
Il tuo file QML definisce già di per sé un componente. L'utilizzo di un tipo " Component " come tipo di primo livello racchiuderà il tuo componente in un altro componente non necessario.
Esempio
import QtQuick
Component {
Item { ... }
}Per risolvere questo avviso, rimuovi il componente Component aggiuntivo che lo racchiude:
import QtQuick
Item { ... }© 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.