Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
renamed-type.qdoc
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qmllint-warnings-and-errors-renamed-type.html
6\ingroup qmllint-warnings-and-errors
7
8\title Renamed Type
9\brief [renamed-type] A type was called by its unexported name.
10
11\qmllintwarningcategory renamed-type
12
13\section1 Renamed Type
14
15\section2 What happened?
16A type, which was renamed via \l QT_QML_SOURCE_TYPENAME or via a hand-written qmldir,
17was called by its unexported name.
18
19\section2 Why is this bad?
20This leads to confusing code, as a single type now has more than one name. Renamed singletons
21won't work correctly when using their unexported name, and the unexported name can't be used
22by QML files outside the current QML module.
23
24\section2 Example
25\badcode
26# CMakeLists.txt
27set_source_files_properties(Tree.qml PROPERTIES QT_QML_SOURCE_TYPENAME BinaryTree)
28qt_add_qml_module(MyModule
29 URI MyModule
30 QML_FILES Tree.qml
31)
32\endcode
33\qml
34// Tree.qml
35import QtQml
36
37Item {
38 property Tree left // uses old name - not ok
39 property Tree right // uses old name - not ok
40}
41\endqml
42
43To fix this warning, replace the old name with the new name:
44
45\qml
46// Tree.qml
47import QtQml
48
49Item {
50 property BinaryTree left // uses new name - ok
51 property BinaryTree right // uses new name - ok
52}
53\endqml
54*/