Skip to content
Frank Bauernöppel edited this page Apr 19, 2017 · 38 revisions

Qt is a great framework for creating (not only) embedded applications with appealing GUIs. The apps are traditionally written in C++, but GUI design can be done in QML, a descriptive language. There is a rich library of platform independent C++ classes, somehow comparable to JAVA or .NET. Read more on the homepage https://www.qt.io/.

Qt: RaspberryPi2 w. eglfs

https://wiki.qt.io/RaspberryPi2EGLFS

Build an image containing the Qt framework

In local.conf check/add a line

GPUMEM = "128"

Setup a bitbake shell and enter:

bitbake qt5-image 

prepare microSD card with this image.

a first test

http://www.jumpnowtek.com/rpi/Qt5-and-QML-Development-with-the-Raspberry-Pi.html has a small app qqtest which can be used for a first GUI test including a USB mouse for input.

building a more complex demo app on RasPi

After installing the image and booting the RasPi: compile a demo app on the RasPi.

root@raspberrypi3:~# wget http://quitcoding.com/download/Qt5_CinematicExperience_rpi_1.0.tgz
root@raspberrypi3:~# tar xvf Qt5_CinematicExperience_rpi_1.0.tgz
root@raspberrypi3:~# cd Qt5_CinematicExperience_rpi_1.0
### a patch needs to be applied, see http://wickwire2099.blogspot.de/2014/05/qt-530-qt5-cinematic-experience.html) 
root@raspberrypi3:~/Qt5_CinematicExperience_rpi_1.0# sed -i 's/onText/textON/g' content/Switch.qml content/SettingsView.qml
root@raspberrypi3:~/Qt5_CinematicExperience_rpi_1.0# sed -i 's/offText/textOFF/g' content/Switch.qml content/SettingsView.qml 
root@raspberrypi3:~/Qt5_CinematicExperience_rpi_1.0# qmake
root@raspberrypi3:~/Qt5_CinematicExperience_rpi_1.0# make
root@raspberrypi3:~/Qt5_CinematicExperience_rpi_1.0# ./Qt5_CinematicExperience

Output on HDMI monitor. USB mouse recommended.

There is also a bitbake recipe for it: bitbake cinematicexperience would have build the demo on the build host.

Build a test app on the build host.

From a bitbake shell:

bitbake qt5-opengles2-test

The output package resides in one of the ${BUILDDIR}/tmp/deploy/ipk/* folders. This time we don't use the package server, but a mere copy over the network (adjust IP address accordingly):

scp ${BUILDDIR}/tmp/deploy/ipk/*/qt5-opengles2-test_1.0.4*.ipk [email protected]:/home/root

On the RasPi install the package:

opkg install qt5-opengles2-test_1.0.4+gitr0+9383905070-r0_cortexa7hf-neon-vfpv4.ipk 

and start it:

qt5-opengles2-test 

Watch the output on an attached HDMI monitor. Its a quite simple test app only, but it demonstrates that all APIs needed are functional. I might be useful to study its recipe under sources/meta-qt5/recipes-qt/examples/qt5-opengles2-test_git.bb.

further reading

Clone this wiki locally