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