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
duplicate-import.qdoc
Go to the documentation of this file.
1// Copyright (C) 2025 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-duplicate-import.html
6\ingroup qmllint-warnings-and-errors
7
8\title Duplicate Imports
9\brief [duplicate-import] Duplicate import.
10
11\qmllintwarningcategory duplicate-import
12
13\section1 Duplicate import
14
15\section2 What happened?
16The document contains duplicate import statements.
17
18\section2 Why is that bad?
19They pollute the document unnecessarily and may slow down startup of the app.
20
21\section2 Example
22
23\qml
24import QtQuick.Controls
25import QtQuick
26import QtQuick 2.1 as QQ21
27import QtQuick.Controls
28
29Item {
30
31}
32\endqml
33To fix this warning, remove all but the last duplicated import. Be careful to
34not change the order of imports, as it can affect type resolution:
35\qml
36import QtQuick
37import QtQuick 2.1 as QQ21 // different from the previous import
38import QtQuick.Controls
39
40Item {
41
42}
43\endqml
44*/