本页内容

重复的导入

qmllint 将此警告类别拼写为[duplicate-import] 。

导入重复

发生了什么?

文档中包含重复的导入语句。

这有什么问题?

它们会不必要地污染文档,并可能减慢应用程序的启动速度。

示例

import QtQuick.Controls
import QtQuick
import QtQuick 2.1 as QQ21
import QtQuick.Controls

Item {

}

要修复此警告,请删除所有重复的导入语句,仅保留最后一个。请注意不要更改导入的顺序,因为这可能会影响类型解析:

import QtQuick
import QtQuick 2.1 as QQ21 // different from the previous import
import QtQuick.Controls

Item {

}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.