[TOOL] [Tut] [Win] Unreal Qt Creator Project Generator v0.3

In this post I want to share a small command line tool with you, which is able to automatically generate Qt Creator projects from Unreal Projects.
I also wrote a small tutorial (partially based on Antares’ tutorial) which covers initial setup of Qt Creator for Unreal development, usage of my tool and (optionally) doxygen help generation for the Unreal Engine classes.

EDIT: Tool now open-source, available on GitHub

Overview

As some of you may have noticed, Visual Studio 2013/2015 (in particular the default IntelliSense auto completion) performs pretty badly when it comes to C++ development with huge codebases (like the Unreal Engine), unless you use something like VisualAssistX (which is not free).

To address this issue, Antares created a nice tutorial (Link | Wiki) on how to manually create a Qt Creator project for Unreal game logic development a few months ago.
Qt Creator is a C++ IDE, which is written in native C++.

Some advantages over vanilla Visual Studio:

  1. Fast auto completion
  2. Fast go to declaration
  3. Refactoring support
  4. Doxygen documentation sidebar

This tool allows you to take advantage of Qt Creator without having to bother with manual creation of projects files.

In theory it should work with any version of Unreal Engine 4. You just have to rerun it whenever you upgrade your project to a new version.

Requirements

  • Visual Studio 2013/2015 (Express / Community / Professional)
  • Unreal Engine 4
  • .Net Framework 4.0 Client Profile
  • Windows, 64-Bit

Features:

The tool can generate .pro files with:

  • Configuration for Unreal Engine development (C++11 support, no Qt)
  • All your current source and header files (+ build.cs) included
  • All Unreal Engine defines and includes added
  • 5 different build and launch targets, which are included in the Visual Studio project file (Debug game, Development Editor, Shipping, etc…)

Download

Here is the link to the GitHub page for download (for usage tutorial with instructions see below)

I cannot guarantee that there are no bugs.
I have tested the tool on two different computers with one small project, some templates and under the following configurations

  • Windows 8.1 64 bit
  • Unreal Engine 4.6/4.7/4.8/4.9/4.13
  • Visual Studio 2013 Community Update 4 / Visual Studio 2015 Community Update 3
  • Qt 5.4/5.5/5.7 and Qt Creator 3.3.0/3.5.0/4.1.0.

By downloading this tool you accept that I am not liable for any damage caused by the use of this tool.

**+++ DOWNLOAD LINK +++ **

Instructions (Partially based on Antares’ tutorial)

These steps you only have to do once

  1. Download Qt 5.x (Link), Debugging Tools for Windows (part of Windows SDK, Link) and my Qt Project Generator Tool (download link above)
  2. Run Windows SDK installer (you only have to install Debugging Tools)
  3. Install Qt, during installation depending on your Visual Studio version select either “msvc2013 64-bit" or “msvc2015 64-bit” under “Qt\Qt 5.x” (where x = latest version, tested with 5.7)
  4. Now you have to configure the debugger. Open Qt Creator, go to “tools/options/Build & Run/Debugger”, click “add” and fill out the details according to this screenshot:

  1. Next go to “tools/options/Debugger”. In the “CDB” tab tick “ignore first chance access violations”. In the “CDB Paths” tab insert the following paths (replace <YOUR USERNAME> by your actual windows username):

symsrv*symsrv.dll*C:\Users\<YOUR USERNAME>\AppData\Local\Temp\symbolcache
	cache*cache*C:\Users\<YOUR USERNAME>\AppData\Local\Temp\symbolcache

  1. IMPORTANT, when you debug a project for the first time, Qt Creator asks whether it should use Microsoft Symbol Server. Untick the corresponding checkbox (Otherwise it will get symbol data from the internet which can be very slow).

symbolServer.png

For the original debugger setup tutorial from Antares see [Link](https://wiki.unrealengine.com/Using_QtCreator_With_UnrealEngine4#Setting_up_the_debugger_for_Qt_Creator).
  1. Next you have to configure a new build kit. Go to “tools/options/Build & Run/Kits”. Click “add” and adjust the new configuration to match this screenshot
    UPDATE: If you use Visual Studio 2015 you should select Visual C++ 14.0 (amd64) under Compiler and Qt 5.x.x MSVC2015_64bit under Qt version

  1. UPDATE: If you are using QtCreator >= 4.7 or have manually enabled “Clang code model” you might experience very slow or unreliable autocompletion. Clang code model offers many advantages over the legacy built-in code model (see link), but on most systems it doesn’t perform well enough to handle UE’s complex codebase. So if you have issues with completion I recommend turning off “Clang code model”.
This can be done globally by disabling the "ClangCodeModel" plugin in QtCreator under Help -&gt; About Plugins -&gt; C++.

The following steps have to be performed every time you create a new project or if you upgrade your project to a new Unreal Engine version.

  1. Run my tool and follow the instructions, the generated project file is stored in the directory <YOUR PROJECT>\Intermediate\ProjectFiles
  2. Done, happy coding :slight_smile: If you want to build or run the project you can just use the preconfigured build / launch targets (you can switch the target in the bottom left corner).
    Targets are the same as in Visual Studio, just remember to always switch both, the compile and the launch target.
    If you want to use a standalone target, you have to make sure your content is already cooked. You can cook by building once with the “Cook” build target.

qtSelectBuild.png

OPTIONAL (but recommended): If you also want nice documentation for the engine within Qt Creator (hover over symbol and hit F1 to display Doxygen inside Qt Creator), here is a quick tutorial:

  1. Install Doxygen (Link), make sure the Doxywizard GUI is selected during installation
  2. Open Doxywizard, choose a working directory (doesn’t really matter what you select, as we don’t use relative paths) and go to the “Expert” tab
  3. Configure Doxywizard according to the screenshots (you can do this for any engine version of course, I chose 4.6 just as an example. Also the Qt path may vary depending on your Qt version)

  1. When you are done, go to the “Run” tab and hit “Run doxygen”, this will take some time.
  2. When generation is finished, shift right-click inside the “html” folder of the Doxygen output and select “open command window here”
  3. Drag and drop qhelpgenerator.exe from your “<QT_Installation>\5.x&lt;your qt msvc kit>\bin” folder into the command window
  4. Insert the command “ index.qhp -o UnrealEngine.qch” and hit enter
  5. When the qch file is generated, open Qt Creator and add your .qch file under “Tools\Options\Help\Documentation”

Update: Source code released on GitHub, tool should work with Unreal Engine 4.9 and QtCreator 3.5.0

Great job. Quick question can you build while in debug mode in Qt? In VS I can execute custom batch files like this one


cd /d F:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
devenv "E:\unreal\Arena 4.9\Arena.sln" /Build

which allows me to build the gameplay code inside VS while in debug mode.

This tool adds 5 build / running targets (like in the Visual Studio project) to the Qt project file.
It looks like this:

qtSelectBuild.png

If you select one of the debug profiles, the project is built in debug mode and then you can debug (Breakpoints, Variable inspection, etc) it directly with QtCreator (if you have setup CDB correctly, see tutorial steps 4-6).

Under the hood, the compilation is done by custom build steps (The QtCreator build system calls the build.bat in the 4.x\Engine\Build\BatchFiles folder with different arguments depending on the selected build preset)

Is this what you mean?

No I am sorry I probably didn’t explain it good enough.

Usually I start the editor in debug mode which allows me to easily add breakpoints while playing the game. But I can’t recompile the gameplay code inside VS while VS is debugging the editor. You can compile the game code from inside the editor but I want to avoid this.

That’s why I am executing a custom bash file from inside VS.

Basically what I am asking is can you hit the “build” button in Qt Creator if it is currently debugging the editor?

I did a quick test.
Hot reload works (you can rebuild in QtCreator while debugging the game in the editor and the changes take effect), but I had problems with breakpoints. It seems they do no longer work after a recompilation (at least on my computer). I don’t know whether Qt Creator doesn’t support this or if it is just a configuration issue.

Update: Hotfix 0.2b
-debug flag was missing in launch configuration “Debug Game Standalone”

Update: Version 0.2c
-added a “Cook” build target, which allows you to cook your game assets from within QtCreator (useful if you work with standalone builds)
-fixed some typos

Any ideas?

Does execution of the tool continue or does it abort with this message? If it does continue, then you can ignore the message (It seems to be a missing if statement and I’ll fix it)
Just a question, are you on 32-Bit Windows? Which Windows version? Because this might be a reason the registry read fails, otherwise you wouldn’t have to enter the path manually.

Edit: Sorry there is another bug, I didn’t remove the quotation marks which are added automatically when you drag and drop a folder to the cmd window from the –> The directory is not found when I try to read it

Thank you for your feedback

I am on Windows 10 x64 and I removed the quotes manually. It seems to be stuck in a loop because it can’t find the engine for some reason.

I uploaded a new version, manual entry of Unreal Engine path should now work.

Edit: Never mind

Update: v0.2d2 now stores your manual engine path input in a file so you only have to enter the path once. Registry-based detection was removed because it wasn’t compatible with newer versions of UE.

Really appreciate that you share you tool with us. Good Work!

Work this in linux?

No this tool only supports Windows.
But doesn’t the Unreal Build Tool generate QtCreator projects (and projects for other IDE’s) out of the box if you are on Linux?

Thanks for this tool! It works except that the debugging is really slow (it takes a long time for Qt to update variable in the “Locals and Expressions” panel).

I followed steps 4-5 and added the CDB symbol paths in “tools/options/Debugger” (and replaced YOUR USERNAME by my username of course):


symsrv*symsrv.dll*C:\Users\<YOUR USERNAME>\AppData\Local\Temp\symbolcache
cache*cache*C:\Users\<YOUR USERNAME>\AppData\Local\Temp\symbolcache

I use CDB from windows kit 8.1.

Thanks for this tool dude! It was realy lifesaver for me as i can finaly work in some realy IDE instead of VS :slight_smile:

Thanks for source too, made some small changes (updated build and run configuration so projects can use ue4 perforce plugin), wanna change how it handles unreal engine paths so developers using custom engine build can use this great tool.

Wanna ask how should i handle my commits, should i create new branch so u can review them and merge them later to new version?

I’m a first time GitHub user so I’m no expert but yes (according to the docs) I think you should fork the repo, apply your changes (maybe in a new branch) and then submit back a pull request. Then I can pull your changes in if I agree with them (as soon as I’ve got some spare time, I’m a little busy at the moment). Just please make sure that you comment your changes and do some testing before submission.

Thanks for your participation:)

Btw for the next version I have planned to introduce a manual configuration file where the user can set engine path and the Qt environment hash. The project file could be detected from the working path of the tool -> Then you could just run the tool inside your project directory and it would do its magic without user interaction (if a valid configuration is detected, otherwise it would display the normal dialogues).

I just submited pull request for qtBuildPreset.xml just little change but pretty important for perforce users :slight_smile:

Good news :slight_smile:

It would make much more sense to implement this kind of tool in python, as command-line script, instead of using C#.

That would make it portable and it would probably take less time as well.