Qt5 "hello world" how-to on BeagleBone Debian

Just posting here so I can refer to this elsewhere. I know a bunch of how-tos have been written, but many are out of date. This will serve as a post that can be pinned for Qt5 related getting-started questions for BeagleBone Debian users.

Some of the existing how-tos:

These look mostly at old versions of Qt, older distro releases and even sometimes depend on rebuilding Qt from sources. Here are some shortcuts before diving into the details those materials introduce.

First of all, you can install Qt5 binaries directly from the Debian repositories [1]:

sudo apt-get install -y qt5-default

To run headless on the “IoT” images before moving to an attached LCD or monitor, make sure you install ‘xauth’ and then ssh from your host machine using ‘ssh -X 192.168.x.2’ where ‘x’ is 6 for Mac/Linux and 7 for Windows:

sudo apt-get install -y xauth

Many of the “hello world” code examples expect Qt4, so be sure to check the migration guide[3]. Below is my

qt_example/hello_qt.cpp:

#include
int main( int argc, char *argv[] )
{
QApplication myapp( argc, argv );
QLabel *mylabel = new QLabel(“Hello world”);
mylabel->show();
return myapp.exec();
}

cd qt_example
qmake -project
echo “QT += widgets” >> qt_example.pro
qmake
make

I saved this in a gist[2].

To get some quick ideas what is possible, there are a couple of BeagleBone demo videos outside of the nice tutorials Derek did:

To understand a bit more about use of Qt in embedded systems, see:

A frequent query is how do you enable 3D acceleration. There is some info at https://elinux.org/BeagleBoardDebian#SGX_BeagleBone.2FBeagleBone_Black, but it looks a little out-of-date to me and I don’t have a chance to try it right now.

Doing a quick search of available packages:

apt-cache search ti-sgx | grep “uname -r

So this works:

sudo apt-get install ti-sgx-ti335x-modules-uname -r

Not sure if this is a complete replacement for the other instructions or if this is sufficient to enable the Qt5 EGLFS for framebuffer rendering of 3D. Perhaps Robert could chime in.

Hope this helps someone!

Regards,
Jason

[1] https://packages.debian.org/search?searchon=names&keywords=qt5-default
[2] https://gist.github.com/jadonk/db2cc4688c5277c84d19a6579e0dca86
[3] https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5