This blog series is about the new Qt Quick Controls 2 to develop mobile apps for Android and iOS.
Qt Quick Controls 2 are introduced as a Technical Preview in Qt 5.6 and willbecome Qt Quick Controls 2 in Qt 5.7.
Qt 5.7 Beta was announced 2016-04-21. This Beta is only available as a download – not from Online Installers.
If you only want to do first steps to try out you can go on with the Qt 5.6 – if you want to get the newest features it makes sense to install Qt 5.7 Beta.
Attention: the new UI Controls are still named ‘qt.labs.controls’ – beginning with the Qt 5.7 RC the renaming into Qt Quick Controls 2 will befinished, so be warned: you must change the imports in your QML files as soon as Qt 5.7 RC is out.
Besides Qt 5.7 Beta you’ll also get a new Qt Creator 4.0 RC.
Here are the steps to download and install Qt 5.7 Beta:
Install Qt 5.7 Beta
Go to your Qt Account – Downloads and select Qt – 5.7.0-beta:
Here’s my download on OSX:
Double click to install:
Log into your Account:
Select the folder where to install:
As next select your components:
and wait for the installer:
Start Qt Creator with -settingsPath
All Qt Creator instances by default share the settings. Having the new Qt Creator 4 and old 3.6.2 using the same settings is no good idea. Also I want to use different working directories for my Qt 5.6 and the new Qt 5.7 Beta.
You can start Qt Creator wit parameter -settingsPath – here’s HowTo do this from OSX:
Search for the Qt Creator.app from Qt 5.7 Beta and do a right-click on the app. Here’s the content:
rename Qt Creator to something like Qt Creator-bin:
From a Text Editor create a Script to execute the Qt Creator-bin with a parameter:
Save this file named “Qt Creator” besides the Qt Creator-bin:_
Now you can start Qt Creator, which will execute the script:
Qt Creator will create the QtProject folder where all the configuration settings are stored.
Now you can start Qt Creator 3.6.1 from Qt 5.6.0 together with Qt Creator 4.0 RC from Qt 5.7 Beta without any collision.
Qt Creator 4.0 RC
First thing you’ll notice after starting Qt Creator 4.0 is the new default flat design. If you don’t like it you can go back to the old one or a dark theme:
And here’s the new flat design:
Qt Creator Preferences Working Directory
Set your working directory for 5.7 Beta:
Qt Creator Preferences Android
Take a look at your Android preferences:
Select your SDK and NDK locations and check ‘Gradle’:
Qt Creator External Tools
I’m developing business apps and business apps always need support of languages (i18n). Configuring the External Tools for Linguist (Qt’s Tool to translate text from your QML and C++ sources) will make it more comfortable.
As first step we’ll add the Linguist App.You’ll find the Linguist at 5.7 –> clang_64 –> bin:
I like to use Tools in english, but the language cannot be changed yet for Linguist, so the trick is to rename the translations file, which in my case is 5.7 –> clang_64 –> translations –> linguist_de.qm:
Under Preferences –> Environment –> External Tools there already exist access to commands for lupdate and lrelease. (lupdate is looking for the strings you marked as translatable and to create or update the translation files <app>.ts. Using Linguist or external tools you can then translate the strings. lrelease compiles these translations from *.ts into *.qm. Only *.qml files will be deployed to your device)
I found out that the default configuration doesn’t work on Android and iOS – please change the executable:
Test if Linguist will start. From External Tools
Linguist should start:
Verify Installation: New qt.labs.controls Project
As last step verify if all is correct configured. Normaly I do this using the qt.labs.controls Gallery app, but because of work on the renaming from qt.labs.controls into Qt Quick Controls 2 it’s missed as part of Qt 5.7 Beta. So let’s try out a brand new qt.labs.controls Project wizard:
Select your Kits – I selected Android and iOS devices:
You’re done. Connect your device via USB and hit ‘Run’:
The app should run on your devices.
Congrats – now you have installed Qt 5.7 Beta. Please follow my blog series: https://appbus.wordpress.com/category/qt-for-mobile/overview/
As soon as Qt 5.7 RC is out I’ll edit the articles containing 5.6 screenshots.