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
unused-imports.qdoc
Go to the documentation of this file.
1// Copyright (C) 2023 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 Unused imports
8\brief [unused-imports] Types of the imported module were not used.
9
10\qmllintwarningcategory unused-imports
11
12\section1 Unused import
13
14\section2 What happened?
15You used an \l{qtqml-syntax-imports.html}{import statement} to import a QML module,
16but did not use any of its types.
17
18\section2 Why is this bad?
19The import statement states a dependency to a QML module which is actually not needed.
20This affects the readability of the code and the performance of the
21QML engine and tooling by making them process an unnecessary QML module.
22
23\section2 Example
24\qml
25import QtQuick
26import QtQuick.Controls
27
28Item {}
29
30\endqml
31To fix this warning, remove the unused import:
32\qml
33import QtQuick
34
35Item {}
36
37\endqml
38*/