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.
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…
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.
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).
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
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.
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.
If we build this project as is we’ll get a simply window with the text “Hello World” in the center.
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