Qt

From ArmadeusWiki
Jump to: navigation, search

Introduction

This page will summarize the process to build, install and use Qt on your APF board. It will focus on Qt5.

Compiling Qt

Select Qt5 from the BuildRoot menuconfig

Target packages --->
   Graphic libraries and applications (graphic/text) --->
      [*] Qt5 --->

Under the Qt5 submenu, you can select the features and Qt modules you need. The most important ones are described below.

Select the following option to accept de free license of Qt. If you don't select the option here, the building of Qt will stop and ask you to accept it.

[*] Approve free license

To dispaly UI you will need the gui module and the widgets module. You need to select de graphical platform you want. For example linuxfb for the framebuffer. You can also set the default graphical platform here instead of passing to your Qt application with the -platform parameter.

[*] gui module
[*]   widgets module
-*-   linuxfb support
...
(linuxfb)    Default graphical platform

To support the touchscreen, enable Tslib support.

[*]    Enable Tslib support

You can then select the Qt modules you need. For example:

  • qt5xmlpatterns if you need to read or write XML files.
  • qt5serialport if you need to use UARTs from you Qt application

Compiling your Qt application

Once Qt is compiled, you need to compile and deploy your application. You can do this from Qt Creator. You need to create a "Kit" for your APF board. See the Qt Creator documentation You will need the following informations:

  • The debugger path is buildroot/output/host/usr/bin/arm-linux-gnueabihf-gdb
  • The compiler path is buildroot/output/host/usr/bin/arm-linux-gnueabihf-g++
  • The qmake paths is buildroot/output/host/usr/bin/qmake

Launching your Qt application

If you want to use the tslib you need to active it first

export QT_QPA_FB_TSLIB=1 # for the framebuffer backend
export QT_QPA_EGLFS_TSLIB=1 # for openGL backend

and specify the input device

export TSLIB_TSDEVICE=/dev/input/event0
# /usr/lib/qt/examples/widgets/widgets/tetrix/tetrix -plaform linuxfb

The Qt Embedded documentation describes all the options you can pass to the Qt framework.