- Qt 6.12
- Qt Qml
- QML Lint Warning and Errors
- Renamed Type
- Qt 6.12.0 Reference Documentation

# Renamed Type

This warning category is spelled `[renamed-type]` by qmllint.

## Renamed Type

### What happened?

A type, which was renamed via QT_QML_SOURCE_TYPENAME or via a hand-written qmldir, was called by its unexported name.

### Why is this bad?

This leads to confusing code, as a single type now has more than one name. Renamed singletons won't work correctly when using their unexported name, and the unexported name can't be used by QML files outside the current QML module.

### Example

     # 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
     }

To fix this warning, replace the old name with the new name:

     // Tree.qml
     import QtQml

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