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

稿源:Developers Area (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Embedded Linux – Working with QT

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录