Obsolete Members for Qt
以下 QML 类型Qt的成员已被弃用。提供它们是为了让旧源代码继续工作。我们强烈建议不要在新代码中使用它们。
方法
- string atob(string data)
(deprecated in 6.11) - string btoa(string data)
(deprecated in 6.11) - object include(string url, jsobject callback)
(deprecated)
方法文件
[deprecated in 6.11] string atob(string data)
自 QtQml 6.11 起,该方法已被弃用。我们强烈建议不要在新代码中使用它。
该方法在解码前对字符串执行 Latin-1 转换,然后将结果解释为 UTF-8。
ASCII 转二进制 - 此函数解码 base64 编码的data 字符串并返回。
[deprecated in 6.11] string btoa(string data)
自 QtQml 6.11 起,该方法已被弃用。我们强烈建议不要在新代码中使用它。
该方法在编码前对字符串执行 UTF-8 转换。
二进制到 ASCII - 此函数返回data 的 base64 编码。
[deprecated] object include(string url, jsobject callback)
该方法已被弃用。我们强烈建议不要在新代码中使用该方法。
不应使用此方法。请使用 ECMAScript 模块以及本地 JavaScriptimport 和export 语句。
包含另一个 JavaScript 文件。此方法只能在 JavaScript 文件中使用,不能在普通 QML 文件中使用。
这会将url 中的所有函数导入当前脚本的命名空间。
Qt.include() 返回一个描述操作状态的对象。该对象只有一个属性status ,可设置为以下值之一:
| 符号 | 值 | 说明 |
|---|---|---|
| result.OK | 0 | 包含成功完成。 |
| result.LOADING | 1 | 正在从网络加载数据。 |
| result.NETWORK_ERROR | 2 | 获取 url 时发生网络错误。 |
| result.EXCEPTION | 3 | 执行包含的代码时出现 JavaScript 异常。在这种情况下,将设置额外的exception 属性。 |
status 属性将随着操作的进行而更新。
如果提供了回调,则会在操作完成时调用callback 。回调传递的对象与 Qt.include() 调用返回的对象相同。
警告: 在严格模式下使用此函数不会将标识符放入当前上下文。
© 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.