Nesta página

Tipo renomeado

Essa categoria de aviso é denominada “ [renamed-type] ” pelo qmllint.

Tipo renomeado

O que aconteceu?

Um tipo, que foi renomeado por meio de QT_QML_SOURCE_TYPENAME ou por meio de um qmldir escrito manualmente, foi chamado pelo seu nome não exportado.

Por que isso é ruim?

Isso gera confusão no código, já que um único tipo passa a ter mais de um nome. Singletons renomeados não funcionarão corretamente quando se usar seu nome não exportado, e o nome não exportado não pode ser usado por arquivos QML fora do módulo QML atual.

Exemplo

# CMakeLists.txt
set_source_files_properties(Tree.qml PROPERTIES QT_QML_SOURCE_TYPENAME BinaryTree)
qt_add_qml_module(MyModule
    URI MyModule
    QML_FILES Tree.qml
)
// Tree.qml
import QtQml

Item {
    property Tree left // uses old name - not ok
    property Tree right // uses old name - not ok
}

Para corrigir esse aviso, substitua o nome antigo pelo novo:

// Tree.qml
import QtQml

Item {
    property BinaryTree left // uses new name - ok
    property BinaryTree right // uses new name - ok
}

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