qt_creator.rst 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. .. _doc_configuring_an_ide_qtcreator:
  2. Qt Creator
  3. ==========
  4. `Qt Creator <https://doc.qt.io/qtcreator/index.html>`_ is a free, open source IDE for all desktop platforms.
  5. Importing the project
  6. ---------------------
  7. - From the Qt Creator's main screen select **New Project > Import Project > Import Existing Project**.
  8. .. figure:: img/qtcreator-new-project.png
  9. :figclass: figure-w480
  10. :align: center
  11. - Under **Location** select the Godot root folder.
  12. .. figure:: img/qtcreator-set-project-path.png
  13. :figclass: figure-w480
  14. :align: center
  15. - Next, you can choose which folders and files will be visible to the project.
  16. While C/C++ files are added automatically, other extensions can be potentially useful:
  17. ``*.glsl`` for shader files, ``*.py`` for buildsystem files,
  18. ``*.java`` for Android platform development, ``*.mm`` for macOS platform development.
  19. .. figure:: img/qtcreator-apply-import-filter.png
  20. :figclass: figure-w480
  21. :align: center
  22. .. note:: You can change this configuration later by right-clicking on your project
  23. and selecting the **Edit Files...** option.
  24. .. figure:: img/qtcreator-edit-files-menu.png
  25. :figclass: figure-w480
  26. :align: center
  27. - Finish the import.
  28. - Open the ``project_name.includes`` file and add a line containing ``.`` to it
  29. to correctly enable the code completion.
  30. .. figure:: img/qtcreator-project-name-includes.png
  31. :figclass: figure-w480
  32. :align: center
  33. - From the left-side menu select **Projects** and open the **Build** tab.
  34. - Delete the predefined ``make`` build step.
  35. .. figure:: img/qtcreator-projects-build.png
  36. :figclass: figure-w480
  37. :align: center
  38. - Click **Add Build Step > Custom Process Step** to add a new build step
  39. with the following settings:
  40. +-----------+------------------------------------------------------------------------------+
  41. | Command | **scons** |
  42. +-----------+------------------------------------------------------------------------------+
  43. | Arguments | See :ref:`doc_introduction_to_the_buildsystem` for a full list of arguments. |
  44. +-----------+------------------------------------------------------------------------------+
  45. .. figure:: img/qtcreator-set-scons-command.png
  46. :figclass: figure-w480
  47. :align: center
  48. .. note:: If the build fails with ``Could not start process "scons"``, it can mean that ``scons``
  49. is not in your ``PATH`` environment variable. In this case, you'll have to specify the
  50. full path to the SCons binary.
  51. Debugging the project
  52. ---------------------
  53. - From the left-side menu select **Projects** and open the **Run** tab.
  54. - Under **Executable** specify the path to your executable located in
  55. the ``<Godot root directory>/bin`` folder. The name depends on your build configuration,
  56. e.g. ``godot.linuxbsd.editor.dev.x86_64`` for 64-bit LinuxBSD platform with
  57. ``platform=editor`` and ``dev_build=yes``.
  58. You can use ``%{buildDir}`` to reference the project root, e.g: ``%{buildDir}/bin/godot.linuxbsd.editor.dev.x86_64``.
  59. - If you want to run a specific project, specify its root folder under **Working directory**.
  60. - If you want to run the editor, add ``-e`` to the **Command line arguments** field.
  61. .. figure:: img/qtcreator-run-command.png
  62. :figclass: figure-w480
  63. :align: center
  64. To learn more about command line arguments, refer to the
  65. :ref:`command line tutorial <doc_command_line_tutorial>`.
  66. Code style configuration
  67. ------------------------
  68. Developers must follow the project's :ref:`code style <doc_code_style_guidelines>`
  69. and the IDE should help them follow it. By default, Qt Creator uses spaces
  70. for indentation which doesn't match the Godot code style guidelines. You can
  71. change this behavior by changing the **Code Style** in **Tools > Options > C++**.
  72. .. figure:: img/qtcreator-options-cpp.png
  73. :figclass: figure-w480
  74. :align: center
  75. Click on **Edit** to change the current settings, then click on
  76. **Copy Built-in Code Style** button to set a new code style. Set a name for it
  77. (e.g. Godot) and change the Tab policy to be **Tabs Only**.
  78. .. figure:: img/qtcreator-edit-codestyle.png
  79. :figclass: figure-w480
  80. :align: center
  81. If you run into any issues, ask for help in one of
  82. `Godot's community channels <https://godotengine.org/community>`__.