1. Home
  2. /
  3. Integra Sources Blog
  4. /
  5. Qt and C++ Embedded Development: Pros, Cons, and Alternatives
Integra Sources home button.

GET IN TOUCH

Qt and C++ Embedded Development: Pros, Cons, and Alternatives

May 04, 2022 21 min read last update: February 19, 2024
Qt HMI applications display equipment operational data in a user-friendly way.
Nina Bibikova

Nina Bibikova

IT Writer, Specializes in Electronics and Software Development Topics

Andrey Solovev

Andrey Solovev

Chief Technology Officer, PhD in Physics and Mathematics

There are a significant number of frameworks for solving various tasks. In this article, we will focus on Qt, one of the most popular frameworks nowadays. We would like to share our experience and provide the pros and cons of using Qt for embedded software development.

Cross-platform app development for embedded systems

Cross-platform toolkits allow developers to build software products for multiple platforms. The task of specialists is to adapt one application to different operating systems.

Cross-platform applications have some undeniable advantages in comparison to native ones:

  • It is a more affordable design.
  • One code for multiple platforms, but each assembly will result in separate executable files;
  • increased development speed.
  • Different applications, such as native ones, look and behave differently on different operating systems.
  • It is a simpler realization.

Developers use frameworks - special tools and libraries for quick application design. Frameworks may have compilers, code libraries, and APIs for creating software.

This article talks about solutions for embedded systems running on Linux/Unix, Windows, and Android.

About Qt and C++

The logo image of the Qt framework

Today we would like to talk about the Qt framework, which is great for creating cross-platform applications for embedded systems. Embedded software is mostly written in C/C++.

C and C++ have very valuable functional and structural paradigms, and C++ extends these paradigms. It makes C++ powerful enough to build abstractions of any order.

Creating a GUI in C++ offers a lot of benefits to the designer since C++ supports object-oriented programming (OOP). OOP makes the process of creating and testing an application faster, easier, and safer. The strength of C++ is not only in its support for object-oriented programming. C++ source code on compilation provides non-portable object code. So, C++ supports the WOCA (Write Once, Compile Anywhere) principle.

Qt is a C++ toolkit for graphical user interface (GUI) and application development. It is appropriate for embedded systems both with and without a UI. Qt supports various platforms, including mobile (Android, iOS), desktop (Windows, Linux, macOS), and embedded (Embedded Linux, Embedded Android, Windows Embedded, QNX, etc.) platforms. The Qt framework has also been successfully used for HMI development.

Qt was developed by Norwegian programmers in the early 1990s. It is now being developed by The Qt Company and The Qt Project as a union of companies and individuals working to promote Qt. The Qt Project follows the open-source governance philosophy, and all members can take part in the decision-making process aimed at improving the framework. 

License

Qt can be obtained under commercial and open-source licenses. You may need to get a commercial license when your project is big enough and you have to protect your interests. When you use a commercial license, you are allowed to distribute Qt libraries in binary form only with the application. Qt licensing costs depend on your business goals. 

If your project involves an open-source distribution or no external distribution at all, then an open-source license will suit you. It could be an LGPL3, GPL2, or GPLv3 open-source license.

Qt instruments for embedded platforms

Useful modules make this framework one of the most convenient for cross-platform application design. Qt with C++ provides the specialized instruments required to design, develop, and set up applications on embedded platforms. Let’s list a few tools. 

Qt comes with an integrated development environment (IDE) called Qt Creator. This IDE simplifies GUI application operation or modification. Qt Creator is applied to building software in C++, QML, and JavaScript. 

Besides, you may use other IDEs as well.

The screenshot of the Qt Creator IDE
The screenshot of the Qt Creator IDE

Qt Designer is the original built-in GUI designer. However, it can be used as an independent tool.

Qt Design Studio is a pared-down version of Qt Creator. It offers a set of 2D/3D instruments for building user interfaces, user experiences, and human-machine interfaces. Qt Design Studio allows designers and developers to increase the level of communication by working in one framework with one common language.

QML, which is Qt's declarative user interface language, enables developers to easily create user interfaces at great speed. UI elements written in QML can be integrated with logic written in C++. Also, QML provides a very convenient way to design UIs for touch screens.

Qt for Microcontrollers 2.0 provides developers with a complete graphical environment and all the necessary tools to successfully design, develop, and deploy GUIs on microcontrollers. The use of Qt products makes it possible to run applications both on real-time operating systems (RTOSs) and on bare metal.

Qt offers the Automotive Suite software modules and tools for building in-vehicle infotainment (IVI) systems. This set has a built-in development environment as well as tools for developing user interfaces, testing, and debugging applications. The Automotive Suite has got the Qt Application Manager, which provides an API for implementing the user interface and application logic independently. It also offers a high-level API to make UI system development easier. The Qt GENIVI Extras module is responsible for the compatibility of the resulting product with the GENIVI automotive platform architecture. Neptune 3 UI (the Reference UI version) aims to develop a user interface for Qt in automotive infotainment (IVI) systems. The Automotive Suite comes with tools such as Qt Design Studio, Qt 3D Studio, Qt Creator Deployment, and several others to help programmers create, install, maintain, and debug a system.

The scheme of the Automative Suite Architecture
The image of Automotive Suite Architecture was sourced from the Qt blog.

Middleware-related components such as APIs, backends, and services can be developed using the tools and APIs provided by the Qt Interface Framework module.

The Qt Safe Renderer module provides a UI rendering element that pulls apart crucial interpretations from other parts of the system. This approach ensures that safety-relevant user interface elements are displayed in the event of failures or abnormal situations.

Qt and C++ for Embedded Devices

Most embedded systems are built in C/C++. 

Why is C++ so well suited for embedded development?

  • This programming language sits between higher-level software and hardware. Developers can access and control hardware while retaining the benefits of a high-level language.
  • The high stability of C++ makes it efficient for hardware since programs written in C++ can run for a very long time. Leave well enough alone, as the saying goes.
  • C++ is processor-independent.
  • C++ enables developers to use abstractions with functional and cost-effectiveness. 
  • The C++ data structure is built on algorithms, so it is well suited to the challenges that arise when developing embedded systems.

The Qt framework multiplies the benefits of C++ through its flexibility, cross-platform support, and the variety of libraries it offers.

To be fair, we should note some of the obstacles that arise when working in C++:

  • One of the biggest hurdles for non-C++ developers is the language's strictness, verbosity, and complexity. C++ is quite difficult to learn.
  • The second challenge stems from the first: maintaining the codebase can be rather hard.
  • C++ may not be flexible enough for web technologies.

Qt developers create embedded systems with intuitive user interfaces, secure and scalable technology, Bluetooth, and Internet connectivity. It could be Qt software for touch screens of various sizes and resolutions, ATMs, in-flight and in-car entertainment, and thousands of other types of embedded systems. Qt is ideal for embedded device applications with or without a GUI. This framework is needed if you have to create a GUI application that can run on another platform. Besides, it lets you develop high-performance applications faster. 

There's no need for the entire development team to be proficient in C++. Non-C++ programmers can also contribute to projects using QML, which improves performance.

Qt C++ embedded systems run on Linux, Windows, and RTOSs. 

Some of the simplest systems operate autonomously, but most devices are linked up with the cloud. They receive information from numerous sensors about what is happening outside. Complicated embedded systems execute sensor data estimation, image recognition, or speech recognition. Qt offers a large number of high-level APIs for embedded devices. For example, the Qt Location API and the Qt Sensors API help get information related to the device’s position and location. 

A scheme of interaction of Qt embedded systems with external sources
Сommunication between Qt embedded systems and external sources.

Systems with less powerful SoCs can delegate some tasks to cloud applications. The controllers check and adjust many parameters inside the device (for example, the water temperature in the washing machine or the monitor screen brightness) and transmit the data to the control center.

Reasons for Choosing Qt 

Integra Sources has developed expertise in creating cross-platform applications using Qt.

Let's list some of the qualities of Qt that influenced our decision to choose it.

  • The key advantage of Qt is the ability to apply the same code to different desktop environments, mobile devices, and embedded devices.
  • Both open licenses and commercial licenses are available. Integra Sources usually selects an open-source license for projects. Yet, the application design is also available under a Qt commercial license at the client’s request.
  • Detailed API documentation, examples, training, technical support, and a large community make Qt very attractive.
  • You are free to create software in the language you prefer. There are many bindings to Qt for Python, Java, PHP, Go, etc.
  • C++ is one of the most widely used embedded software languages.
  • The Qt Creator IDE, with its build system and rich plugin architecture, is fast and responsive.

Integra Sources has got a team of experts writing programs in C++, including for embedded systems. We find Qt to be very handy. 

Projects we did with Qt

A team of developers is discussing a project.

The number of projects in which we use this framework is constantly growing. Let's talk about the latest tasks.

Our responsibility for one of the projects was to develop an Android application for debugging and configuring the customer's device. The device was a reel with cylinder bottles equipped with a spray system. It was controlled by the customer’s protocol via BLE. The technology would be used in the marketing and entertainment industries.

Integra Sources’ developers had to create an application that could connect to one or more devices, send commands, and receive responses. Many commands had custom parameters, so the application required different input fields. Also, a video player had to be implemented. As soon as the player reached a certain timestamp, the application had to send a command to the device to spray a certain fragrance.

For the application implementation, we chose the C++/Qt/QML stack. In addition, Java code was used. Qt made it possible to create an Android application with all the necessary functions very quickly. The Qt Connectivity module has speeded up the development of the BLE part by providing ready-made Bluetooth solutions. Using the Qt Multimedia module, our specialists created a video player with a range of features.

Screenshots of the application with audio designed with Qt
Screenshots of the application designed with Qt

The objective of another project was to create a device with sensors for measuring the distance to obstacles and to build a mobile application for interacting with the devices. The radar module was supposed to transmit a point cloud over BLE. The Orange Pi microcomputer had to transmit the image from the CSI camera using the RTSP (Real-time Streaming Protocol) via Wi-Fi to the Android tablet. We intended to use Qt for building Android applications.

Significant difficulties that arose during the implementation of the project required revision. Therefore, our developers decided to replace the Orange Pi with the Raspberry Pi for the correct interaction with the camera and Bluetooth. The new idea was to create a tablet Wi-Fi hotspot with a specific SSID and a password. When the sensor (the ATPS module) detects a Wi-Fi network with the selected SSID, it should automatically connect to the network. The mobile app should transmit its IP address to the device via BLE. The video stream from the camera had to be passed via RTSP. We decided to transmit sensor data as well as information messages via a TCP connection. While developing the client-side in Python, we faced the problem of low performance. The Qt framework helped solve this issue. 

Our Qt developers created an embedded application that could work with both BLE and TCP without delays in the data processing. Qt enabled us to use the Wiring Pi library to communicate with an external buzzer and an I2C LED module.

The lead time for the project was prolonged due to identified obstacles. Having chosen Qt for the client part of the project, our developers created a rather complex application in a short time. It allowed us to reduce the backlog. You can learn more about using the QT framework to develop BLE-enabled cross-platform applications by reading the article on our blog.

One of our projects using Qt was connected to agriculture. Our specialists had the task of developing a mobile application for iOS and Windows to interact with various microcontrollers and sensors. 

A scheme of the software-hardware complex in the agricultural sector
A scheme of the software-hardware complex in the agricultural sector

Thus, microcontrollers with sensors were installed on agricultural machines to collect telemetric indicators. The application should process the collected data in real-time. Microcontrollers installed in the warehouse turned on the hot air supply and disinfectant gas spray, while also monitoring temperature and humidity. The microcontrollers should communicate with the application via Amazon Web Services (AWS). 

Another task of the application was to gather data from temperature sensors installed in the warehouse. 

Our developers created an application using Qt. It allowed them to shorten lead times and save the client money. The customer was satisfied with the work done. Integra Sources is eagerly looking forward to our further collaboration.

Working with Qt and C++, we encountered some drawbacks (fortunately, all of them turned out to be surmountable). Here they are:

  • Creating applications in C++ is time-consuming.
  • The speed of the Qt GUI is slow.
  • The GUI internalization (I18N) is far from perfect.
  • Cross-compilation may require additional steps to be taken.

In general, our team has positive impressions of working with the framework. With Qt, developers save time, and customers save money by getting efficient cross-platform applications.

Other multi-platform solutions as alternatives to Qt 

Debates among programmers about the best framework will never end. Each developer gives his/her arguments in favor of a particular platform, and everyone could be right. The choice of one structure or another depends on the project’s size and goal. It also depends on the developer’s experience, competence, and the customer’s wishes.

We'll take a look at Qt-like solutions and highlight what each of them is good for.

Cross-platform toolkits are used for embedded software development.

1. .NET, or dotNet, is a development platform made by Microsoft. The platform's main characteristics are as follows:

  • free and open-source software
  • Microsoft Windows, Linux, and Mac OS X are all supported.
  • C #, F #, and Visual Basic are all supported languages;
  • Visual Studio Client
  • It has its own community.

.Net is a modular and cross-platform solution based on the .Net Framework. Each of its modules can be upgraded individually. Various realizations of dotNet help run its code on different platforms. 

This structure has a wide variety of compilers, libraries, and APIs for developing and compiling mobile and game applications with ease.

The DotNet platform is good for re-designing applications and making them suitable for the needs of the company.

2. The .NET nanoFramework is a free and open-source structure based on .NET for small embedded devices. The .NET nanoFramework combines flexibility, high functionality, and high performance, blurring the line between the desktop developer and the embedded system developer.

3. Xamarin is a popular tool for cross-platform mobile application development based on the concept of “Write once, Run anywhere” (WORA). According to Microsoft, “Xamarin extends the .NET developer platform with tools and libraries specifically for building apps for Android, iOS, tvOS, watchOS, macOS, and Windows.”

Key elements of Xamarin:

  • free and open-source software;
  • based on the .Net;
  • C# is used;
  • tools that are natively compiled;
  • The Xamarin Universal Library and Planet Xamarin projects provide developers with important information and useful resources.

4. Flutter is a framework for GUI application development released by Google in 2017. It supports the WORA principle.

The main features of the structure are

  • Platforms such as Windows, Linux, Android, iOS, and others are all supported.
  • Dart support;
  • It's compatible with IDEs like Eclipse, Android Studio, Visual Studio Code, and Intellij.
  • design-specific widgets.

Flutter allows developers to build applications faster and more efficiently. It interacts directly with machine code, exhibiting impressive performance.

5. Java is one of the most popular programming languages in the world. It is a platform-independent and object-oriented programming (OOP) language. All Java frameworks support the WORA concept, meaning that compiled code is able to run on all Java platforms.

The platform provided by Java, in addition to the language itself, includes code libraries and frameworks, which are very popular among developers.

You can choose Java to develop scalable, handy, and downloadable embedded systems applications. This language is secure due to its support for encrypting sensitive information and is suitable for GUI projects with multiple screens.

On the other hand, Java is complex, and its efficiency is not very high in comparison to other languages.

6. You can use GTK+ for creating GUI programs. 

The main features of the widget toolkit are:

  • open-source (under the LGPL license);
  • multi-platform;
  • C is the language used.
  • There are C++, dotNet, and Python bindings available.
  • Good support for powerful themes;
  • compatible with Windows, Linux, and macOS.

GTK has so many obvious shortcomings, such as poor backward compatibility in main updates, a lack of cross-platform support, and an absence of community.

7. A Simple DirectMedia Layer (SDL) is a cross-platform software development library. It provides a unified programming interface for graphics, audio, and input devices across a wide variety of platforms. Developed with the help of SDL, multimedia applications can run on Android, Linux, Windows, macOS, and iOS.

The main features of SDL are:

  • open-source (under the zlib license);
  • Written in C, C++, or Objective-C depending on the target platform;
  • There are language bindings for other languages available as well.
  • Support for multiple windows
  • 2D graphics that are hardware-accelerated
  • It is actively used for cross-platform multimedia programs (mainly games).

GUI frameworks in C++

C++ is a programming language.

The list of C++ high-level widget toolkits seems to be impressive, but not all of them are cross-platform. Nevertheless, there are plenty of solutions similar to Qt technology. Let's compare them with Qt in usability and functionality.

wxWidgets allows developers to create applications for Linux, Windows, and some other environments.

Advantages of wxWidgets:

  • open-source;
  • mature, but rather speedy;
  • uses native widgets (where possible) to ensure a natural look and feel.
  • It has a very convenient wxCrafter designer.

Drawbacks to wxWidgets:

  • It is difficult to set up.

FLTK (Fast Light Toolkit) is a cross-platform C++ GUI toolkit for UNIX/Linux, Microsoft, and Windows. FLTK supports 3D graphics. The toolkit is available under the GNU Lesser General Public License (LGPL) with some exceptions.

FLTK advantages

  • lightweight and simple design, and only GUI features.
  • online support;
  • rather fast.

Drawbacks:

  • makes use of non-native widgets.
  • It provides fewer widgets than other platforms.

Supported by Windows, Linux, iOS, macOS, and Android, JUCE is on the list of cross-platform C++ frameworks. JUCE is licensed under the terms of the GPL and ISC licenses (depending on the module). JUCE is free for individuals, startups, and educational institutes.

JUCE advantages

  • a large set of audio functionalities.
  • lightweight;
  • It is less expensive than Qt (paid versions).

Disadvantages:   

  • Lack of clear information about the toolkit;
  • The free version has restraints.

Another useful C++ rapid application development platform is Ultimate ++ (U++, or Upp). It contains GUI, SQL, and other libraries and focuses on efficiency. It includes an IDE, called TheIDE, whose interesting features, like the BLITZ-build technology, allow you to boost the rebuilding of C++.

Pros of U++:

  • Linux/Unix, Windows, and macOS support;
  • It is simple to apply and learn.
  • visual designers for U++ libraries;
  • A C++ code analyzer
  • helpful tutorials, community, and documentation.

U++ has the following drawbacks:

  • closed-source software;
  • only C++.

There are a lot of other C++ UI frameworks that may be employed for cross-platform application development. Each of them has loyal users who have accumulated experience in using a particular toolkit.

Conclusion

The IT industry offers us a lot of frameworks for cross-platform application development. It’s impossible to choose the best one. The same task can be solved in different ways based on the knowledge, experience, and capabilities of the developer.

Qt is a C++ multiplatform application and GUI framework. Once created with Qt, applications can be compiled on lots of other platforms. Qt is a widget toolkit since it allows us to build software with native-looking GUIs. C++ is one of the most popular languages for embedded devices, and Qt is one of the most popular frameworks among C++ GUI toolkits. It provides designers with all the instruments for software development. Integra Sources has a skilled staff of Qt developers. 

Our level of expertise in C/C++ and Qt is very high. There are many projects in our portfolio where Qt has been successfully used for embedded systems development. Qt is constantly being improved and supplemented with new useful tools that allow developers to solve many tasks with efficiency and with less time. Contact us to learn more information.

Nina Bibikova
Nina Bibikova
IT Writer, Specializes in Electronics and Software Development Topics

Andrey Solovev
Andrey Solovev
Chief Technology Officer, PhD in Physics and Mathematics