Qt Creator setup for OpenFOAM

This is yet another tutorial on Qt Creator setup for OpenFOAM, however more visual.
Hope you find it useful.
For more information, take a look at  openfoamwiki.net/index.php/HowTo_Use_OpenFOAM_with_QtCreator.

1) Install Qt Creator

The first thing you should do is to install Qt Creator. If you already have Qt Creator installed, skip to step 2.
Go to Google and search for 'qt creator download'. Then select the appropriate link for your system.
I ended up downloading "Qt Online Installer for Linux 64-bit" from  qt-project.org/downloads.
The installation is pretty forward as follows.

Go to the folder where you downloaded Qt to.
In my case, it was downloaded to Home/Downloads as in the figure bellow:
qt installer file *.run
Right click on the file and select Properties from the menu.

The Properties dialog will popup as bellow:
qt installer file *.run
Select Permissions tab and check Allow executing file as program.
Hit close button and double click on the file.

The Qt Setup dialog will be displayed:
qt installer file *.run
Just follow the installation steps on the dialog and you will be fine.

2) Create a Project for OpenFOAM

In Qt Creator dialog, select File > New File or Project...
You will end up with the New dialog as bellow:
Select Import Project and then, Import Existing Project.
Hit Choose... button.

You will see the Import Existing Project dialog:
Edit Project Name and choose the path to your *.C and *.H files.
Hit Next:
Select the files you want to add to your project. If you don't see your files, it is probably because of the file filter.
In this case, add to Show files matching the file extensions: '*.C;*.H'.
Then, select the files you wish to add to your project.
Hit Next and then Finish buttons.

On the left list, double click on the file named '*.includes'.
Add to it the include paths your will need.
This is needed for the autocomplete feature.

Now, let's take a look at the '*.C' file.
Observe the variable runTime.
The autocomplete feature works fine! You just need to press Ctrl + SPACE.
This is something that I didn't manage to do neither in Eclipse nor Netbeans.
In Eclipse and Netbeans, the autocompletion only worked for me for variables declared in the *.C files.
As OpenFOAM declares variables not only in *.C files, but also in *.H (not so usual in C++), the autocompletion did not work in both IDEs.
However, Qt Creator works fine!

3) Edit "Build and Run" Settings

In Qt Creator dialog, select the Projects tab qtsetup
Edit the Build Steps as in the figure above.
Basically what you need is to point to foamExec and pass wmake as argument.
For the Clean Steps follow the same procedure, but pass wclean as argument.

4) Build your Project

From the top menu, select Build > Build Project.
You can see the output by clicking on Compile Output button.

Hope this tutorial helps.

Last update: March 26th, 2019