Thursday, August 9, 2018

Cross-compiling full Qt 5.11.x for Raspberry Pi: error with QGeoMap class in Qt Location module

From this post, an error appears when cross-compiling Qt 5.11.x (full from source code tarball, i.e. qt-everywhere-src-5.11.0.tar.xz) and following the steps from this guide
The solution I found:

Wednesday, August 8, 2018

Qt on Raspberry: QFontDatabase error

After deploying a cross-compiled Qt application for the Raspberry Pi boards (by following this guide), this error message appears:

QFontDatabase: Cannot find font directory /usr/local/qt5pi/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.

Friday, July 13, 2018

Qt Test or not Qt Test

Are you convinced that unit tests are a great tool for great software development? I really am. Having a (good) set of unit tests allow you to be sure that changes to existing code (i.e. refactoring) may not break it, and if you are lean to Test Driven Development (TDD) they allows you to think about the "contract" or responsibilities of a class before actual implementation.

Tuesday, June 12, 2018

Cross-compiling QtMqtt module for Raspberry Pi

A previous post of mine described the Qt module for MQTT protocol, and how to compile it for the Android platform. That seems a good fit to develop a client application for a dashboard for instance, where you can subscribe to different topics and monitor the evolution of such items.
Ok you'll say, but what about creating MQTT publishers, i.e. devices that may have sensors and will provide the readings with MQTT messages?

Saturday, June 9, 2018

Cross-compiling QtMqtt module for Android

As the MQTT potocol continues to get traction in the IoT world, more and more people seems to rely on Qt MQTT module to implement clients applications that can communicate over the MQ telemetry transport (MQTT) protocol. And given the device-based nature of such clients, it's very likely that you may need the module available for different platforms/architectures.

Thursday, June 7, 2018

QLocalSocket under *nix is SOCKET_STREAM only

While developing a library for Qt to interact with Sense HAT add-on board for Raspberry Pi, I started with the software side, the Sense Emulator. This application emulates the components of the board, and makes the data from emulated sensors, stick and LED matrix available through several files. Under *nix the stick events are provided via a Unix domain local socket as datagrams, constructed in Python like this:

(socket.AF_UNIX, socket.SOCK_DGRAM, '/dev/shm/rpi-sense-emu-stick')

So I thought QLocalSocket was the perfect fit for connecting the library to the Sense Emulator server socket, receive and decode the data and publish it as signals to Qt applications using the library.
But as I started making some tests, I was not able to receive any data. And although everything was in place, it was not working.

Sunday, June 3, 2018

Just one library with different immplementations? d-pointer desing pattern to the rescue

I'm developing a library based on Qt to access the Sense HAT add-on for Raspberry Pi. It's based on ideas and code from Qt's experimental module and from this other library. The ultimate goal is to provide a library that can be used with either the actual hardware or the Sense Emulator without any code changes to the program using it.

Qt default parameter value

What is the proper place for the default value of a parameter ? Just in function definition, or declaration, or both places? Qt code has plenty of methods using this approach i.e. QDialog::QDialog(QWidget * parent = 0, Qt::WindowFlags f = 0) so what if you're defining a new method and need a similar behavior?

QML signals to C++? No, the other way around please

While developing an application with QML and C++ please refrain to emit signals in QML that should be handled by C++ code. Just the opposite, keep QML as the UI layer and expose your C++ object to QML (as a context property or with qmlRegisterXXX) and then call a slot or a Q_INVOKABLE method of this object from QML.

Monday, March 12, 2018

Getting your fancy Qt application show up on Android startup

Let's say you have your super duper Qt application ready for Android platform, but you want it to run on startup.

Thursday, February 8, 2018

Timer or Stopwatch?

A well known feature of Qt framework (at least what I guess) is the QTimer class, which essentially allows to have repetitive tasks or calculations at a given time interval. Think of it as a timer, that when it goes off, sends the timeout() signal and starts again the countdown for another interval. But a less known feature (at least what I guess) is the QElapsedTimer class, which acts the opposite: once started, you can know the elapsed time since that moment by calling the ellapsed() method.

Thursday, January 18, 2018

Using Qt Creator to cross-compile and debug Raspberry Pi Qt5 apps

Have you ever wonder how to setup Qt Creator in your powerful workstation to develop Qt apps that can be deployed and tested in your Raspberry Pi (reachable from such workstation)?