Qt Creator

Qt Creator is a free, open source IDE for all desktop platforms.

导入项目

  • From the Qt Creator's main screen select New Project > Import Project > Import Existing Project.

../../../_images/qtcreator-new-project.png
  • 在**Location**项下选择 Godot 源代码目录的绝对路径。

../../../_images/qtcreator-set-project-path.png
  • Next, you can choose which folders and files will be visible to the project. While C/C++ files are added automatically, other extensions can be potentially useful: *.glsl for shader files, *.py for buildsystem files, *.java for Android platform development, *.mm for macOS platform development.

../../../_images/qtcreator-apply-import-filter.png

注解

你可以在之后通过在你的项目上右键选择**编辑文件..**选项来更改此配置。

../../../_images/qtcreator-edit-files-menu.png
  • 完成导入。

  • 打开 project_name.includes 文件,并在其中添加包含 . 的行,以正确启用代码自动完成功能。

../../../_images/qtcreator-project-name-includes.png
  • From the left-side menu select Projects and open the Build tab.

  • Delete the predefined make build step.

../../../_images/qtcreator-projects-build.png
  • 单击**Add Build Step > Custom Process Step**,以添加具有以下设置的新构建步骤:

    命令

    scons

    参数

    See 构建系统介绍 for a full list of arguments.

../../../_images/qtcreator-set-scons-command.png

注解

If the build fails with Could not start process "scons", it can mean that scons is not in your PATH environment variable. In this case, you'll have to specify the full path to the SCons binary.

Debugging the project

  • From the left-side menu select Projects and open the Run tab.

  • Executable 下指定位于 <Godot根目录>/bin 文件夹中的可执行文件的路径。文件名取决于你的编译配置,例如: godot.x11.tools.64 对于64位X11平台,启用 tools 。你可以使用 %{buildDir} 来引用项目根目录,例如: %{buildDir}/bin/godot.x11.opt.tools.64

  • If you want to run a specific project, specify its root folder under Working directory.

  • If you want to run the editor, add -e to the Command line arguments field.

../../../_images/qtcreator-run-command.png

要了解更多的命令行参数,请参考 命令行教程

代码风格配置

Developers must follow the project's code style and the IDE should help them follow it. By default, Qt Creator uses spaces for indentation which doesn't match the Godot code style guidelines. You can change this behavior by changing the Code Style in Tools > Options > C++.

../../../_images/qtcreator-options-cpp.png

Click on Edit to change the current settings, then click on Copy Built-in Code Style button to set a new code style. Set a name for it (e.g. Godot) and change the Tab policy to be Tabs Only.

../../../_images/qtcreator-edit-codestyle.png

如果遇到问题,也可在 Godot社区论坛 中寻求帮助。