QML 快速修复
对 QML 代码应用以下类型的快速修复:
- 重命名 ID
- 拆分初始化器
- 将 QML 类型移入单独文件,以便在其他 .qml 文件中重复使用
下表总结了 QML 代码的快速修复。当光标位于激活栏中描述的位置时,该操作可用。
快速修复 | 说明 | 激活 |
---|---|---|
将组件移入单独文件 | 将 QML 类型移动到一个单独的文件中。为新组件命名,并选择是为新组件还是为原始组件设置属性。 | QML 类型名称。 |
分割初始化器 | 将单行类型重新格式化为多行类型。例如,重写Item { x: 10; y: 20; width: 10 } 改写为 Item { x: 10; y: 20; width: 10 } | QML 类型属性 |
在加载器中包裹组件 | 将类型包裹在 Component 类型中,并在 Loader 类型中动态加载。这样做通常是为了缩短启动时间。 | QML 类型名称 |
添加信息抑制注释 | 在行前添加注释注解,以阻止信息生成。 | 来自静态分析的错误、警告或提示 |
另请参阅 应用快速修复、重命名符号、从待办事项列表中排除文件、查找符号、为快速修复指定设置、快速修复和C++ 快速修复。
Copyright © The Qt Company Ltd. and other contributors. 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.