QTCreator Installation
Requirements
- You must have a fairly up-to-date version of your operating system (Windows, MacOS, or Linux).
- You will need to download multiple gigabytes of data. If you do not have fast internet service at home, and have a laptop, consider trying to do the installation at a library.
Prep
If you are on Mac or Linux, you need to do some quick setup:
Mac
You will need to install XCode (Apple's development tool) before installing QT. Find and install it on the app store.
Linux
Linux you may need to install other packages first. You need gcc, cmake and gdb for Ubuntu and other apt based distros you can try installing build-essential, gdb and cmake like this:
sudo apt-get install build-essential
sudo apt-get install gdb
sudo apt-get install cmake
If while installing you get errors about not being able to find -lGL you will need:
sudo apt-get install libglu1-mesa-dev
Download
Go to https://www.qt.io/download
You want the Open source version:
On the following page, scroll down to the bottom to download the online installer:
The installer needs to run on a computer that is connected to the internet so it can download the components you select. If you need to install on a computer that is not connected to the internet, or has a slow or metered connection, you should try downloading the Offline Installer at school or somewhere with a fast connection, putting it on a flash drive, and then install from that.
Installation
Launch the QT Online installer. Continue until you get to the account screen. If this is your first install, you will need to make a new Qt Account to download the software.
Acknowledge the Open Source License:
Then continue until you get to the Installation Folder screen. On it, look for Desktop Development installation
If it is available, select it. If not, select Custom installation:
If you are doing a custom installation the following screen you pick the things to install.
Windows - Custom Installation
Skip this if you were able to do Desktop Development Installation
Open the topmost menu item that says Qt X.XX (highest number version). Look for whatever item starts with MinGW and check it:
Then, scroll way down to Developer and Designer Tools. Within that section, look for the biggest number version of MinGW and check it. (If there is a version that says 32bit and one that says 64bit you want the 64bit one.)
Mac
Skip this if you were able to do Desktop Development Installation
You will want to do something just like the Windows first step, only instead of looking for MinGW under QT X.XX, you should look for a version that specifies macOS (Mac).
You will not need to do the second step under Developer and Designer Tools.
Linux
QTCreator is available as a package that you can install via:
sudo apt install qtcreator
If that does not work, you can try the installer. Don't worry about the "MinGW" related options that are needed for Windows.
Post Installation - Mac Only
If you are using MacOS 12.3 or above ( here is how to find out), you will need to do the following after installing QTCreator. If you are using an older version of MacOS, you can skip this step.
Download this file: openTerminal.py Make sure to save it to your Downloads folder (that should be the default location). Then, open a Terminal window (this is a window where you can type text commands to interact with your computer).
Once the terminal window is open, copy and paste in these two lines - one at a time - into the terminal (or type them):
cd ~/Downloads
cp -f openTerminal.py /Users/$USER/Qt/Qt\ Creator.app/Contents/MacOS/../Resources/scripts/openTerminal.py
These should copy the openTerminal.py file you downloaded into QTCreator to replace the original one.
QTProject Template Setup
QTCreator stores its preferences in a folder called QTProject. To install the Chemeketa project templates and set some important preferences, grab this compressed QTProject folder: https://computerscience.chemeketa.edu/guides/qtcreator-setup/QtProject.zip
Then unzip the folder. You should end up with a folder called QtProject with this inside it:
(There should NOT be a second folder called QtProject inside the first one. If there is, ignore the outer QtProject folder and use the inner one that actually contains QtCreator.ini and qtcreator.)
We need to move the QtProject folder to the location that QTCreator will look for it. Directions vary by platform:
Windows
The QTProject folder needs to be placed in the directory:
C:\Users\YOUR_NAME\AppData\Roaming
To find this folder, you need to enable viewing of hidden items:
Then you should be able to navigate from C: to Users to YOUR_NAME to AppData then Roaming. Move or Copy the QTProject folder there:
Mac / Linux
The QTProject folder needs to be placed in the directory:
~/.config/
This is a hidden folder named .config in your home directory (~/ is your home directory).
You can get there on Mac using Command+Shift+G
and typing ~/.config/
as the destination.
The .config folder may or may not already exist. If you are told that folder does not exist, you will have to create it. Open a Terminal window. Type the following two commands into it:
cd ~/
mkdir .config
The first makes sure you are in your home directory (cd: change directory). The second one makes a new folder (directory) called .config.
Place the QtProject folder inside this .config folder.
Testing the Project Template
Once you install the QTProject folder, start QTCreator and do the following to confirm your setup:
Create a New Project:
You should see Chemeketa Projects as an option:
If you do not see the Chemeketa Project templates, the most likely problem is that your QTProject folder is in the wrong location. When you start QTCreator, if it cannot find a QTProject folder it will make one. Look for this folder and replace it with the provided one.
Select Chemeketa Basic Project
Click Next until you get to Kit Selection. Make sure at least one kit is selected. If you are on Windows, you should make sure that it is the MinGW kit:
If Next button is grayed out on the Kit Selection Screen. screen, then you most likely did not install the compiler (MinGW on Windows, Xcode on Mac). If on a Mac, make sure Xcode is installed and then reinstall QT. If on Windows, rerun the installer and make sure MinGW is selected in two locations.
You now should be looking at code that shows "Hello World". Build the code with Build > Build Project menu item (or
ctrl-B
). Then run the program with Build > Run (orctrl-R
).A window should appear that displays the text
Hello World!
. (If you are on a mac it will display some other text as well - you can ignore the other text.)
Common Issues
The Terminal Window Does Not Appear When You Run
If when you run a program, the terminal window does not open to show you the output, but instead it appears inside the lower panel in QTCreator, do the following:
Go to Edit > Preferences. Under the Build and Run settings, look for Default for "Run in Terminal" and make sure it is set to Enabled. This will only affect new projects that you make. To confirm it worked, make and run a new project.