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