Umbenannter Typ
Diese Warnkategorie wird von qmllint als „ [renamed-type] “ bezeichnet.
Umbenannter Typ
Was ist passiert?
Ein Typ, der über QT_QML_SOURCE_TYPENAME oder über ein manuell erstelltes qmldir umbenannt wurde, wurde mit seinem nicht exportierten Namen aufgerufen.
Warum ist das schlecht?
Dies führt zu verwirrendem Code, da ein einzelner Typ nun mehr als einen Namen hat. Umbenannte Singletons funktionieren nicht korrekt, wenn ihr nicht exportierter Name verwendet wird, und der nicht exportierte Name kann nicht von QML-Dateien außerhalb des aktuellen QML-Moduls verwendet werden.
Beispiel
# 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
}Um diese Warnung zu beheben, ersetzen Sie den alten Namen durch den neuen Namen:
// 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.