Setting Up Qt Creator

From Estone Technology Wiki
Jump to: navigation, search

Downloading Qt Creator 5.7.0

Note: This Qt 5.7.0 installation and testing has been done between (Ubuntu 18.04.2 LTS 64-bit) host machine & EMB-2230

  • On host machine
$ cd ~/
$ wget https://download.qt.io/archive/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run
$ chmod +x qt-opensource-linux-x64-5.7.0.run
$ ./qt-opensource-linux-x64-5.7.0.run

Installing Qt

Note: Follow the Qt5.7.0 Setup Installer to install on host machine

1. In Qt 5.7.0 welcome screen installer press Next to go to next screen
Qt-5.7-installer-1.png


2. Press the Skip button
Qt-5.7-installer-2.png


3. Press the Next button
Qt-5.7-installer-3.png


4. Press the Next button
Qt-5.7-installer-3.png


5. In Select Components window please select the components you want to install and press Next button.

Note: In example we will leave these default
Qt-5.7-installer-5.png


6. Read and agree to the terms in license agreement and continue by choosing Next
Qt-5.7-installer-6.png


7. Wait for Qt 5.7 to install all the components
Qt-5.7-installer-7.png


8. Once all the Qt 5.7 Components are installed press the Finish button to finalize the Qt creator installation
Qt-5.7-installer-8.png


Installing Qt dependencies

  • Install g++

Open a terminal and execute the following command to install g++:

$ sudo apt-get install build-essential
  • Install generic font configuration library - runtime

execute the following command to install the full runtime files for the generic font configuration library:

$ sudo apt-get install libfontconfig1
  • Install OpenGL libraries

Execute the following command to install OpenGL libraries:

$ sudo apt-get install mesa-common-dev
$ sudo apt-get install libglu1-mesa-dev -y

Configuring Qt 5.7.0

Setting up qtcreator.sh

  • We will configure the Qt Creator 5.7.0 before startup
$ cd ~/Qt5.7.0/Tools/QtCreator/bin/
$ sudo nano qtcreator.sh

Note: Make sure to add the environment setup directories into the first line of the qtcreator.sh fscript file (before #! bin/sh) as shown in the image below
Add Line: source /opt/poky/2.1.3/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
Qt-5.7-installer-9.png

Ctrl+x to save qtcreator.sh
"Yes"
Ctrl+x to exit nano

Setting up dpkg-reconfigure

$ sudo dpkg-reconfigure dash

Note: When prompted package configuration press <No> to continue
Qt-5.7-installer-10.png

$ . /opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi qtcreator > /dev/null 2>&1

Starting Qt 5.7.0 Creator

  • This section will start and select appropriate options to connect to EMB-2230
$ cd ~/Qt5.7.0/Tools/QtCreator/bin/
$ ./qtcreator.sh

Qt-5.7-installer-11.png


Setting up EMB-2230 in Qt 5.7.0

1. In the Qt Creator main window go to Tools > Options...
2. In the Options.. window go to Devices and press on Add...to start the Device Wizard to connect to new device
Qt-5.7-installer-15.png


3. In Device Configuration Wizard Selection change device to (Generic Linux Device) and press Start Wizard button
Qt-5.7-installer-12.png


4. In the Device Configuration Setup window change the following according to the EMB-2230 settings:

The name to identify this configuration: (emb-2230)
The device's host name or IP address: (192.168.1.65)
The username to log into the device: (root)

5. Once these settings have been changed press Next > to continue
Qt-5.7-installer-13.png


6. Once you have finished the device configuration press Finish
Qt-5.7-installer-14.png


7. Press the Test button and make sure the device test is successful and close the Device Test
Qt-5.7-installer-16.png


8. Once you have tested the EMB-2230 connection with the Qt Creator press Apply button on bottom right corner to save the device options.

Setting up Build & Run

  • This section will set up the Compilers, Qt Versions, Kits & Debuggers

Set up Compilers

1. Go to Build & Run > Compilers > Add > GCC to add new compiler
2. Press the Browse... button to look for the compiler executable you want to use
Qt-5.7-installer-17.png


3. Navigate to the compiler path and choose arm-poky-linux-gnueabi-g++ as a compiler and Open
Compiler Path: /opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/
Qt-5.7-installer-18.png


4. Press Apply button on bottom right corner to apply the compiler settings


Set up Qt Versions

1. Go to Build & Run > Qt Versions > Add... to add qmake to Qt Versions
2. The select a qmake Executable window will open and we will choose the path to locate qmake
qmake Path: /opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/ Qt-5.7-installer-19.png


3. Choose the qmake file located in the qmake path directory and Open
Qt-5.7-installer-20.png


4. Press Apply button on bottom right corner to apply the Qt Versions settings

Set up Debuggers

1. Go to Build & Run > Debuggers > Add and select a new Name then press Browse... to browse for a Debugger
Name: (emb-2230)
Debugger Path: /opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/
Qt-5.7-installer-22.png


2. Navitate to the debugger path and choose arm-poky-linux-gnueabi-gdb as a debugger and press Open to open the file Qt-5.7-installer-23.png


3. Press Apply button to apply the Debugger Settings


Set up Kits

1. Go to Build & Run > Kits > Add to add a new kit for emb-2230
2. After pressing the Add button fill in the following fields:
Name: emb-2230 Qt 5.8.0
Device Type: Generic Linux Device
Device: emb-2230 (default for Generic Linux)
Sysroot: /opt/poky/2.1.3/sysroots/cortexa9hf-neon-poky-linux-gnueabi
Compiler: GCC (Created from Set up Compilers Section)
Qt Version: Qt 5.8.0 (qt5)
Qt-5.7-installer-21.png


2. Press Apply to apply and save Kits settings

Note: After these settings have been applied you can go back to the main window of the Qt Creator

Starting a New Qt Project

  • In this section we will build a new simple "Hello World" Qt Project that we can deploy to the EMB-2230

1. In Qt Creator main window select New Project to start new project
Qt-5.7-installer-24.png


2. In the New Project window press the type of application you want to create then press the Choose... button once type of application is chosen
- In this example we will create a Qt Console Application
Qt-5.7-installer-25.png


3. Choose a name for the test application and choose a directory where you want to store the application being created
4. Once the name and save directory are chosen press Next > button
Name: test-hello-world
Create In: /home/habey-tech
Qt-5.7-installer-26.png


5. Next choose the Kit Selection you created in the previous section emb-2230 Qt 5.8.0 and uncheck your host system kit Desktop Qt 5.7.0 GCC 64bit
6. Press Next > button once the kit selection has been chosen
Qt-5.7-installer-27.png


7. You can change the Project Management settings if required. For this Qt Application we will leave these settings Default
8. Press Finish to finish the settings for our "Hello World" test project
Qt-5.7-installer-28.png


Testing Qt Project

  • Now we will test our test "Hello World" Qt project and run on the EMB-2230

1. Go to the Edit section of the project and open the test-hello-world.pro file
2. Edit the following lines in .pro file:

 13 linux-*{
 14    target.path =/home/
 15    INSTALLS += target
 16 }

Qt-5.7-installer-32.png


3. In the test-hello-world go to Sources > main.cpp and open the main.cpp file to edit the following lines:

2 #include <iostream>
3 #include <stdlib.h>
4 using namespace std;
--------------------------------------------
8
9    cout<<”Hello World”<<endl;
10

Qt-5.7-installer-33.png


4. Once these lines have been edited for both of these files, build the application by pressing on the build icon on the bottom left corner of the Qt Creator
Note: If the application was successfully build then the Build green bar will show on the bottom right corner as shown in the image below
Qt-5.7-installer-34.png

Qt-5.7-installer-35.png


5. Next, you can deploy the application by pressing on the green Play button on the bottom left corner of the screen or press the Play-Debug button beneath the play button to deploy the application with debug properties
Qt-5.7-installer-36.png


6. If the application deployed correctly with no errors to EMB-2230 there will be output with no errors Qt-5.7-installer-37.png