本页面

导入文件选择器

此警告类别由 qmllint 拼写为[import-file-selector]

由于目前 QML 工具对带有文件选择器的 QML 模块的限制,默认禁用此类别。

导入时出现警告

发生了什么?

QML 工具在导入的模块中发现了模棱两可的类型,这是因为在导入的模块中使用了文件选择器。QML Runtime 会根据运行时配置选择适当的文件,而 QML 工具没有选择哪个文件的信息,因此产生了歧义。

为什么会这样?

QML 工具无法使用导入:编译器无法将此文件编译成 C++ 和qmllint,也无法提供有用的警告。 QML Language Server都不能对该文件提供有用的警告。

© 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.