本页内容

在 QML 代码中跳转

查找 QML 方法和类型,并跳转到 QML 类型的 C++ 实现。

定位 QML 方法

要定位 QML 方法:

  1. Ctrl+K激活定位器。
  2. 输入 m,然后按空格键。

    定位器中的 m 过滤器

  3. 在列表中双击一个 QML 方法,即可在编辑器中跳转至该方法。

查找 QML 类型

要在项目中查找 QML 类型的实例,请将光标置于该类型上,然后执行以下操作之一:

  • Ctrl+Shift+U
  • 转到“Tools ” > “QML/JS ” > “Find References to Symbol Under Cursor ”。

检查 QML 和 JavaScript

要检查 QML 和 JavaScript 的属性、方法和枚举,请将光标悬停在其上,然后转到“Tools ” > “QML/JS ” > “Inspect API for Element Under Cursor ”。

在 QML 和 C++ 之间切换

要在代码编辑器中跳转到某个 QML 类型的 C++ 实现,请将光标置于该类型上,然后执行以下操作之一:

  • F2 键
  • 在上下文菜单中选择“Follow Symbol Under Cursor ”。

另请参阅 《操作指南:编辑代码》《Clangd》、《编辑代码》以及《使用定位器导航》。

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.