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
\ingroup qmllint-warnings-and-errors
6
7
\title Renamed Type
8
\brief [renamed-type] A type was called by its unexported name.
9
10
\qmllintwarningcategory renamed-type
11
12
\section1 Renamed Type
13
14
\section2 What happened?
15
A type, which was renamed via \l QT_QML_SOURCE_TYPENAME or via a hand-written qmldir,
16
was called by its unexported name.
17
18
\section2 Why is this bad?
19
This leads to confusing code, as a single type now has more than one name. Renamed singletons
20
won't work correctly when using their unexported name, and the unexported name can't be used
21
by QML files outside the current QML module.
22
23
\section2 Example
24
\badcode
25
# CMakeLists.txt
26
set_source_files_properties(Tree.qml PROPERTIES QT_QML_SOURCE_TYPENAME BinaryTree)
27
qt_add_qml_module(MyModule
28
URI MyModule
29
QML_FILES Tree.qml
30
)
31
\endcode
32
\qml
33
// Tree.qml
34
import QtQml
35
36
Item {
37
property Tree left // uses old name - not ok
38
property Tree right // uses old name - not ok
39
}
40
\endqml
41
42
To fix this warning, replace the old name with the new name:
43
44
\qml
45
// Tree.qml
46
import QtQml
47
48
Item {
49
property BinaryTree left // uses new name - ok
50
property BinaryTree right // uses new name - ok
51
}
52
\endqml
53
*/
qtdeclarative
src
qml
doc
src
qmllint
renamed-type.qdoc
Generated on
for Qt by
1.16.1