ImaginativeThinking.ca


A developers blog

Creating your first Qt Quick Project

By: Brad

In my previous post I showed you how to install a C++ compiler for Qt Creator to use. In this post I’ll walk you through creating your first Qt Quick project.

Qt Creator is the native IDE for Qt; it allows you to create Qt projects of different types, has a text editor with syntaxual highlighting, integrated help documents, refactoring tools, and much much more.

QtCreator

Lets get started shall we, in your Qt Creator click on File -> New File or Project; This will bring up the new Project/File wizard. Lets create our first Qt Quick project shall we; pick QtQuick UI then click Choose…

QtCreator_1

This brings up the New Qt Quick UI Project dialog which asks you to enter a project name and pick the location to save the project files too.

QtCreator_2

Enter QMLSampleApplication as the project name. Notice that the default project location is buried under the Qt bin directory, I’m not much of a fan of making my project files hard to find so lets change that. Click on Browse and pick a more convenient location to store your first ever Qt Quick project file (I choose to create a new folder under my Documents library).

QtCreator_3

Now click Next to move on to picking what component set to include. In this dialog pick Qt Quick 2.0 in the drop down to tell Qt Creator that we want to make a Qt Quick 2.0 project vs. a Qt Quick 1.1 project then click Next

QtCreator_4

The last screen is where Qt Creator will automatically add the project to your source repository (a very handy feature) but since I’ve not set one up on this box we’ll just leave it set to None. Click Finish to create your new project.

QtCreator_5

And there you go you have your first Qt Quick project. Notice now in Qt Creator under the project view you have a folder named QMLSampleApplication. This is your project folder;
you can have multiple projects open at one time in Qt Creator and each one will be listed in this view under their own project folder. Inside the QMLSampleApplication project folder you have two files QMLSampleApplication.qmlproject and QMLSampleApplication.qml. The *.qmlproject is your project file; it contains all the project related settings.

The *.qml file is your main QML file (think main.cpp in a typical C++ project). If you open the QMLSampleApplication.qml file you will see some default QML that equates to a simple Hello World program.

QtCreator_6

QtCreator_7

If we build this project as is we’ll get a simply window with the text “Hello World” in the center.

QML_Sample1_1

See my next post for a tutorial on the Hello World QML program. If you have any questions or comments feel free to leave them below and I’ll respond when time permits.

Until next time think imaginatively and design creatively

Brad

My interest in computer programming started back in high school and Software Development has remained a hobby of mine ever since. I graduated as a Computer Engineering Technologist and have been working as a Software Developer for many years. I believe that software is crafted; understanding that how it is done is as important as getting it done. I enjoy the aesthetics in crafting elegant solutions to complex problems and revel in the knowledge that my code is maintainable and thus, will have longevity. I hold the designation Certified Technician (C.Tech.) with the Ontario Association of Computer Engineering Technicians and Technologists (OACETT), have been certified as a Professional Scrum Master level 1 (PSM I) and as a Professional Scrum Developer level 1 (PSD I) by Scrum.org as well as designated as an Officially Certified Qt Developer by the Qt Company. For more on my story check out the about page here

Feel free to write a reply or comment.