Obsolete Members for QQmlEngine

QQmlEngine 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。

公共函数

(deprecated in 6.4) bool importPlugin(const QString &filePath, const QString &uri, QList<QQmlError> *errors)

成员函数文档

[deprecated in 6.4] bool QQmlEngine::importPlugin(const QString &filePath, const QString &uri, QList<QQmlError> *errors)

自 6.4 版起,该函数已被弃用。我们强烈建议不要在新代码中使用它。

请使用 "import "语句从 QML 导入模块。

使用uri 导入名为filePath 的插件。如果插件成功导入,则返回 true;否则返回 false。

如果失败且非空,则errors 列表中将会有发生的错误前缀。

插件必须是实现QQmlEngineExtensionPlugin 接口的 Qt XML 插件。

注意: 像这样直接加载插件会混淆模块导入逻辑。为了让导入逻辑从特定位置加载插件,可以使用addPluginPath() 。每个插件都应是 QML 模块的一部分,可以使用 "import "语句导入。

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