While testing recently cross-compiled Qt libraries (5.15.0) for Raspberry Pi 3 running ArchLinuxARM using a sample application (qopenglwidget) I received error:
Could not open DRM device /dev/dri/card0 (Permission denied)
Showing posts with label Qt. Show all posts
Showing posts with label Qt. Show all posts
Monday, June 8, 2020
Saturday, April 4, 2020
Qt Creator: Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable
I've just installed Qt 5.12.7 with offline installer, and having previously setup the Android SDK and NDK, along with Java 8, when starting Qt Creator for the first time the following messages appeared under tab "6 General Messages":
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /opt/Qt5.12.7/5.12.7/android_armv7/mkspecs/android-clang/qmake.conf.
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /opt/Qt5.12.7/5.12.7/android_armv7/mkspecs/android-clang/qmake.conf.
Labels:
Android,
Android NDK,
Android SDK,
ANDROID_NDK_ROOT,
Java,
Qt,
Qt 5.12.17
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:
Labels:
cross-compile,
GCC,
GCC 4.9,
GCC 8.1,
QGeoMap,
Qt,
Qt Location,
Raspberry Pi,
Raspberry Pi tools
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.
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.
Labels:
dejavu-fonts,
fontconfig,
fonts,
QFontDatabase,
Qt,
Raspberry Pi,
Truetype
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.
Labels:
Qt,
Qt Test,
qttestlib,
refactoring,
TDD,
Unit testing,
unit tests
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?
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?
Labels:
cross-compile,
cross-platform,
IMU,
MQ,
publisher,
Qt,
QtMQTT,
Raspberry Pi,
sensors,
subscriber
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.
(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.
Labels:
*nix,
Linux,
Python,
QLocalSocket,
Qt,
Sense Emulator,
SOCKET_DGRAM,
SOCKET_STREAM,
Unix
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.
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.
Labels:
Android,
Android permissions,
OS boot,
Qt,
RECEIVE_BOOT_COMPLETED,
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.
Labels:
QEllapsedTimer,
Qt,
QTimer,
stopwatch,
timer
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)?
Labels:
cross-compile,
debug,
device,
kit,
Qt,
Qt Creator,
Raspberry Pi,
Yocto
Wednesday, November 29, 2017
QWidget: Must construct a QApplication before a QWidget
Have you faced such error message? It's specially likely to appear if you are using Qt framework along with 3rd party libraries. The solution?
Wednesday, November 22, 2017
Emit signals of other objects...
It'll depend on the Qt version you're using. If Qt 5.x it's easy, as signals are public methods. And the 'emit' keyword expands to an empty string, so just both entries below are equivalent:
1. create public method in class A, that will emit necessary signals
2. create signal in class B and connect it to a signal in class A
Given all that said, please remember that it might not be a good idea to emit signals of other objetcs directly.
IMO signals are intended to be emitted by a class as a response to some event, i.e. a QPushButton object will emit the clicked() signal when the user clicks with the mouse on such button. So if you really needs that button to emit the clicked() signal, my approach is to provoke the right event so that signal is finally emitted. Following this example, you need to call QPushButton.click() method instead of emitting the signal directly, but having the exact same behavior as a result of the object's reaction to a particular event.
Happy coding!
a.signal_X();
emit a.signal_X();If using Qt 4.x, it's not that easy since signals are protected methods so you can't emit signals directly. However, there are a couple of approaches to achieve that:
1. create public method in class A, that will emit necessary signals
2. create signal in class B and connect it to a signal in class A
Given all that said, please remember that it might not be a good idea to emit signals of other objetcs directly.
IMO signals are intended to be emitted by a class as a response to some event, i.e. a QPushButton object will emit the clicked() signal when the user clicks with the mouse on such button. So if you really needs that button to emit the clicked() signal, my approach is to provoke the right event so that signal is finally emitted. Following this example, you need to call QPushButton.click() method instead of emitting the signal directly, but having the exact same behavior as a result of the object's reaction to a particular event.
Happy coding!
Monday, October 23, 2017
Raspbian: /opt/qt/bin/qmake: cannot execute binary file: Exec format error
If you're cross-compiling Qt for Raspberry Pi (for instance following this guide), and once everything finished and seems Ok, you may encounter the following error while running qmake:
/opt/qt/bin/qmake: cannot execute binary file: Exec format error
/opt/qt/bin/qmake: cannot execute binary file: Exec format error
Labels:
cross-compile,
exec error,
host,
moc,
qmake,
Qt,
Raspberry Pi,
rcc,
RPi,
uic
Friday, September 8, 2017
pkg_config and qmake
If you're developing an application with Qt which in turn relies on some library that uses the pkg-config tool, you can take advantage and simplify your Qt project file (.pro) as it will help avoiding hard-coded values for where to find headers and libraries for a particular package.
Labels:
include headers,
libraries,
OpenCV,
pkg-config,
PKGCONFIG,
qmake,
Qt
Wednesday, April 5, 2017
Make the compiler fail if using deprecated Qt features
Instead of making the compiler warn you if using deprecated Qt features (see previous post), by using QT_DISABLE_DEPRECATED_BEFORE it's even possible to make your code fail to compile if you use deprecated APIs.
Labels:
.pro,
compiler,
project files,
qmake,
Qt,
QT_DISABLE_DEPRECATED_BEFORE
Make the compiler warn you of deprecated Qt features
QT_DEPRECATED_WARNINGS is a keyword that can be used in your Qt's project files (.pro) so qmake makes your compiler emit warnings if you use any feature of Qt which as been marked deprecated. The exact warnings depend on your compiler, but it'll be easy to spot any location in your source base that might be affected for any Qt's API changing soon.
Labels:
.pro,
API,
compiler,
deprecated API,
project files,
qmake,
Qt,
QT_DEPRECATED_WARNINGS
Monday, April 3, 2017
Ever dreamt of creating your own QML controls?
Were you in need of a control not provided in the QML controls set? Have you wondered how difficult could such an enterprise be to write and use your own QML control to fit your needs? Do you feel like contributing any new QML control back to the community?
Labels:
custom control,
Qml,
QQuickPaintedItem,
Qt,
radial bar
Friday, February 10, 2017
Assign radio buttons to QButtonGroup in Qt Designer
When you use the Qt designer to design your form, you can group buttons by selecting them and choosing "Assign to button group" then "New button group" from the context menu.
Labels:
QButton,
QButtonGroup,
Qt,
Qt Designer,
setupUI
Subscribe to:
Posts (Atom)
