Embedded Linux – Working with QT

Qt is a great framework for building cross-platform applications. It provides a set of classes to wrap almost any OS service and you can write your application once and compile and deploy it many.

Qt is also a great choice for embedded Linux system. If you need GUI, Qt is the fastest way. Write your code and test it on your desktop computer and then compile and deploy it to the target system.

In this tutorial, we will use the system we build using QEMU to configure, compile and test QT 5 applications.

Build QT using Buildroot

It is very easy to configure QT for embedded Linux system using buildroot. Open the configuration menu:

# cd ~/armsystem/fs/buildroot-2017.02.8
# make menuconfig

Go to Target packages > Graphic libraries and applications (graphic/text) and select Qt5

in Qt5 menu select the following options:

Save and run make, then copy the output to ~/armsystem/outfs

Now you can check some QT examples in /usr/lib/qt/examples

 

Build your own QT application

Download and install Qt creator from here – select the free version

Run Qt Creator, select new project -> Qt Widgets Application

Name your project

 

Select Desktop QT

Select all defaults and click finish

On the project tree select mainwindow.ui:

Draw push button and lineedit controls

Right-click the push button and select go to slot… -> clicked

Write the button event handler:

void MainWindow::on_pushButton_clicked()
{
    ui->lineEdit->setText("hello QT");
}

Build and run the project on your desktop

 

Build The Application For The Target

Go to the project directory and build for the target using qmake and make:

# cd ~/qt_projects/Test1/
# qmake
# make
# cp ./Test1 ~/armsystem/outfs

Now you can run it on the target

 

Tagged

2 thoughts on “Embedded Linux – Working with QT

  1. Very good tutorials, please continue I’ll be fun of your posts.

  2. […] are seeing this because your blog was recently used as part of a DDOS attack against […]

Comments are closed.