How to create a simple hello world Qt application using Qt creator in Linux. Make a very simple windowed GUI application in Linux using the Qt creator IDE. No need to write any code in this simple tutorial.
Part 3 of the Qt Creator C++ Tutorial
Simple Hello World Qt Application Window
The image below shows the simple application window built in this part of the Qt creator C++ tutorial series.
Simple Hello World Application Tutorial Steps
Follow the video near the top of this tutorial page to see how to build this simple hello world application using Qt Creator. A description of the steps follows.
Before starting, be sure to install Qt creator and supporting tools. Also create a folder for saving all new Qt Creator projects to. This can be in any preferred location on your computer.
1. Start Qt Creator
In Linux Mint Qt Creator can be found under the main menu, then Programming → Qt Creator
2. Create a New Project
In Qt Creator, click the New Project button. Click Qt Widget Application in the new project dialog box. Now click the Choose… button.
3. Create a Sub-Folder and Name the Project
In the next dialog box, click the Browse… button. Now navigate to the project folder. Create a new sub-folder for this project and select it.
Name the project in the Name field. In this example the sub-folder and project name are both simple_hello as can be seen in the following image.
4. Finish Creating the Project
Click the Next button. Leave the default of Desktop selected in the Kit Selection dialog box.
Click Next again. Leave the Class Information fields at their defaults.
Once again click the Next button. Leave the Project Management dialog box fields at their defaults.
Finally click the Finish button.
5. Build the Project
Click the hammer icon at the bottom left of Qt creator to build the project. See the image below.
6. Run the Project
Click the run icon at the bottom left of Qt creator to run the project. The run icon is the first green triangle “play” button at the bottom left.
A small blank window will appear after running the project. This is the Qt GUI application window.
7. Add a Label
Expand the Forms item in the top left pane of Qt Creator. Double-click mainwindow.ui that appears under Forms. This puts Qt Creator into design mode and allows us to edit the application window.
First delete the default widgets found on the main window. Use the right pane and right click each one. See the video for details.
Find the Label widget in the left pane under Display Widgets. Drag and drop it onto the main window.
Change the label text to Hello, World! using the bottom right pane in Qt Creator. Again, see the video for more details.
Build and run the project again.