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
shadow.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 Shadow
8\brief [shadow] A member shadows another member.
9
10\qmllintwarningcategory shadow
11
12\section1 Signal or method already exists in base type
13
14\section2 What happened?
15A member in the current component has the same name as a signal or method from a base class.
16
17Note that properties shadowing other properties are handled by the \l{Property override} category.
18
19\section2 Why is that bad?
20The shadowed signal or method can't be used anymore. It makes the code more difficult to read
21and may cause confusion.
22
23\section2 Example
24\qml
25import QtQuick
26
27Item {
28 component Base: Item { signal f(); }
29 Base {
30 property int f: 42
31 }
32}
33\endqml
34
35To fix this warning, rename the signal \c{f} or the shadowing \c{int} property.
36
37\qml
38import QtQuick
39
40Item {
41 component Base: Item { signal f(); }
42 Base {
43 property int notF: 42
44 }
45}
46\endqml
47*/