Qt

From Rockchip open source Document
Jump to: navigation, search


Setup qt backend

There are multiple platform plugins that are potentially usable on Embedded Linux systems: EGLFS, LinuxFB, KMS, DirectFB, Wayland.

More info at the fllowing link: http://doc.qt.io/qt-5/embedded-linux.html

If you want to use x11 or wayland plugin, you need set distribution to x11 or wayland.

If you plan to use Qt5 eglfs plugin for accelerated graphics, you need to use rk-none distribution rather than x11, wayland distribution.

MACHINE=<MACHINE> DISTRO=rk-none . ./setup-environment -b <build_dir>

Bitbake image

Bitbake a qt image (you need to be in your yocto/build directory):

bitbake qt5-image

Note: If bitbake fails with an error regarding cmake or drm recipes, locate their directories, delete them and try again.


Tips

examples

The examples program usually will not be build. You have to add following line to your local.conf to enable example build and then you can find it in directory 'tmp/work/cortexa17hf-neon-vfpv4-rk-linux-gnueabi/qtmultimedia/5.7.0+gitAUTOINC+1be4f74843-r0/deploy-debs/cortexa17hf-neon-vfpv4'

PACKAGECONFIG_append_pn-qtmultimedia = " examples"

Please change qtmultimedia to the qt package name you want to build example.

eglfs

The mouse cursor in eglfs is moving slow than X11, because it is render via OpenGLES. If you want to use hardware cursors which are more efficient, you can check the fllowing link: http://doc.qt.io/qt-5/embedded-linux.html#touch-input-in-systems-with-multiple-screens-on-kms-drm

player

To develop a player application, you need include a extra meta package, which contains necessary patches for the "UI over video layer" feature.

See https://github.com/rockchip-linux/meta-rockchip-extra/tree/master/meta-demo/meta-player-qt

Cross compile Qt5 for QtCreator

It is now very easy to build an environment for cross compilation using QtCreator. Version 2.2 in paths refers to Yocto Morty branch, if you are using different branch please use corresponding paths.

bitbake a meta-toolchain-qt5

Bitbake a toolchain (you need to be in your yocto/build directory):

bitbake meta-toolchain-qt5
Install your new toolchain

Run the new installer that has been generated in yocto/build/tmp/deploy/sdk

apt-get install qtcreator
sh <DISTRO>-glibc-x86_64-meta-toolchain-qt5-cortexa17hf-neon-vfpv4-toolchain-2.2.1.sh


This will install a cross compiler and its needed environment including the Qt5 arm libraries.

Configure Qt creator

Run qtcreator from the terminal after running the setup environment script located in /opt/<DISTRO>/2.2.1

cd /opt/<DISTRO>/2.2.1
. ./environment-setup-cortexa17hf-neon-vfpv4-rk-linux-gnueabi
qtcreator


In QtCreator go to Tools > Options > Devices and add "rockchip" as a generic linux device.

go to Tools > Options > Build & Run and:

  • Add a new compiler. Select your compiler: /opt/<DISTRO>/2.2.1/sysroots/x86_64-rksdk-linux/usr/bin/arm-rk-linux-gnueabi/arm-rk-linux-gnueabi-g++
  • Add your new cross compiled Qt version by selecting the qmake located in /opt/<DISTRO>/2.2.1/sysroots/x86_64-rksdk-linux/usr/bin/qt5
  • Add a new kit selecting your new Qt5 version and compiler and setting the sysroot to /opt/<DISTRO>/2.2.1/sysroots/cortexa17hf-neon-vfpv4-rk-linux-gnueabi and set the Qt mkspec to "linux-oe-g++".
  • Finally select your "rockchip" for the device.