本页面

导入文件选择器

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.