What is Qt and how to create GUIs using it?

Software development
2023-11-15
16 minutes
Qt development

We cover Qt-related issues on our blog, but only recently realized that many of our readers may not even know what Qt is at all 🧐.

That’s why I decided to write this post which is kind of an answer to the most frequently asked questions: What exactly is Qt development? Why use it and how to create GUIs with it? I will try to answer all these questions in this post. Once you have read it, you will no longer be bothered by these questions.

If you are already familiar with Qt, I encourage you to read it anyway, because you can always learn something new. However, if you have any questions that bother you and cannot find the answer or you need support in Qt, QML, or C++ software development, I also encourage you to check our Qt development services page.

So without further ado, let’s get started!

 

What is Qt Framework? – short story behind Qt project

Let’s start with the basics, what exactly is Qt? In its simplest terms, Qt is an open-source framework for creating cross-platform applications with a graphical user interface. Qt framework was initially developed by Trolltech, a Norwegian software company, in the mid-1990s. In 2008, Nokia acquired Trolltech and continued to support and develop Qt.

Subsequently, Qt was adopted by various industries and became open-source (right now Qt framework is run by The Qt Company). I won’t go into too much detail about the history of the development of the framework in this article, but those who are curious can take a look at the graphic below.

Qt primarily works with C++ programming language, making it a preferred choice for developers working with this language. Additionally, Qt supports another programming language: Python through PySide. There are also language bindings to Rust, Java, and other languages.

The open-source nature of the Qt project encourages collaboration and innovation. Developers can access the source code, fix bugs, and add new features, contributing to the ongoing improvement of the framework. If you are interested in contributing then you can always count on someone from the Qt team to help you out.

We at Scythe Studio are also trying to make our contribution by working on Qt development πŸ’ͺ (both as Qt contributors and in official collaboration with The Qt Company).

I have already written several times that Qt is a “framework”, but what do I really mean by that? After all, when I write an application in C++ I have a lot of classes and functions at my disposal, so why do I need more? Well, exactly, because the appetite grows as you eat πŸ˜‰ .

More than once, when you’ve been writing a project, the thought has crossed your mind to add some cool functionality: be it a database, perhaps a network solution, or maybe a sophisticated user interface. However, using pure C++ is often difficult or almost impossible, which is why Qt comes to the rescue! So read on to learn more about its possibilities.

Qt history diagram

In graphics, the last year was 2015 however the adventure with Qt continues today! Source

 

Cross-Platform Development – Qt Supports Every Platform

I described Qt earlier as a “cross-platform framework”. What does that mean? In simplest terms, cross-platform software means applications that can run on many platforms without the need to change the technology. So let’s look at which platforms we can use Qt on.

 

Desktop Qt Applications

The first platforms that come to mind are, of course, desktops. Qt allows applications to be written for all available desktop systems, i.e. Microsoft Windows, mac OS (previously OS X), and Linux.

One of Qt’s notable strengths on desktops is its ability to create visually appealing and responsive graphical user interfaces (GUIs). It offers a wide range of UI components and widgets that can be customized to match the specific design and branding requirements of the application. Qt also provides support for high DPI displays, ensuring that applications look sharp and professional on modern screens.

See how we deal with desktop projects.

 

Software Development for Embedded Devices

Since I mentioned Linux, the light related to embedded devices probably went on for many of you. Well, here again, no surprise, Qt also allows programming for embedded Linux and more πŸ˜‰

Qt is a valuable framework for embedded system development, offering a range of features and tools tailored to this domain. Embedded systems are specialized, often resource-constrained devices, and Qt’s versatility makes it a compelling choice for creating graphical interfaces and applications in this context. Qt’s lightweight nature allows it to run efficiently on embedded hardware with limited processing power and memory. There is even a special Qt module called Qt for MCUs (Microcontrollers) for less performant embedded devices.

Qt also offers support for various embedded platforms, such as Raspberry Pi, NVP devices, Qualcomm devices, ST devices, and more from other producers. All of that with various OS layers – Linux, Yocyo, QNX, and a few others. This ensures that developers can target a wide range of embedded hardware platforms without having to rewrite code for each specific device.

 

Qt Technology on Mobile Platforms

“What about mobile devices like my smartphone?” – here Qt is not left behind either. The Qt software can run on both Android and iOS devices. It’s truly a cross-platform development framework.

One of the standout features of Qt in the mobile space is its ability to deliver native-like user experiences. Qt allows developers to design responsive and visually appealing mobile user interfaces that resemble native apps, enhancing user experience. If needed, Qt also provides support for specific features and services, such as device sensors, GPS, and camera access.

 

Qt Essentials, Qt Add-Ons, and others

As I mentioned, Qt is a set of tools, or more specifically, modules. Each module in Qt helps us achieve a specific functionality (for example Qt SQL module helps us with database operations).

The main modules have been gathered into the ‘Essentials‘ category, which helps implement the most popular solutions, such as GUI, multimedia, networking, Qt test classes, or sensor support. They are equally supported on all platforms.

On the other hand, if we are looking for more “exotic” functionality, modules from the “Add-ons” category can help. The graphic below shows the modules in question:

Qt modules

We can see that Qt is like a Swiss Army Knife, there is a tool for everything!

 

Qt Creator, Qt Designer, and other Qt tools

The graphic with the modules also shows us the platforms on which Qt runs (we have already discussed this), but on the right-hand side, we also see the ‘Development tools’ section. Yes, the creators of Qt have not limited themselves to writing the framework, in addition, we also have a lot of tools available to help us develop applications.

The most popular is Qt Creator – an integrated development environment (IDE) designed specifically for developing applications using the Qt framework. It provides a set of tools and features tailored to Qt application development, making the process more efficient and streamlined.

Here are some key characteristics of Qt Creator:

  • Cross-Platform Support: Qt Creator is available on multiple platforms, including Windows, mac OS (OS X), and various Linux distributions, ensuring a streamlined development process.

  • Code Editor: Qt Creator features a powerful code editor with features like syntax highlighting, code completion, and code navigation, making it easier for developers to write code and manage their code.

  • Integrated Debugger and Profiler: It comes with a built-in debugger that simplifies the process of finding and fixing issues in your code.

  • …And many more!

I use Qt Creator daily and it gets better with every update. For beginners, I recommend the “examples” tab, which presents examples of applications on which we can draw.

Qt creator

Other tools include for example: Qt Linguist for the simple creation of translations for applications, Qt Design Studio and Qt 3D Studio for the creation of 2D and 3D user interface elements, and Qt Assistant for documentation generation.

 

Qt GUI Development

At its core, the Qt framework grew up as a toolkit tailored for graphical user interface development, and this is still its most important functionality. And it has to be said that Qt does this very well! A GUI written in Qt can be customized very easily and provides us with a wealth of possibilities.

 

Qt Quick (QML) vs Qt Widgets

Writing the GUI itself in Qt, you should start by choosing an approach. And there are two. Using Qt Quick (QML) or Qt Widgets. Both are Qt modules, however, they are slightly different.

Qt Widgets allows you to use pre-built GUI elements (called widgets) such as windows, text boxes, buttons, and so on. This is a solution that was implemented first but had several drawbacks (e.g. difficulties in creating a modern UI with a large number of animations, etc.). The creation of UI using Qt Widgets is based on C++ language and WYSIWYG editor – Qt Designer.

Therefore, the Qt company decided to implement a new solution, the Qt Quick module, which, in a nutshell, allows the same things as Qt Widgets (also allows the creation of UI elements), but is more modern and better adapted to modern requirements. In addition, when writing the GUI with Qt Quick, it is written using the declarative QML language (using a QML file with .qml format). It is straightforward to use and introduces a better separation of frontend (QML) and backend (C++/Python). QML also adds support for JavaScript functions.

As Qt is a cross-platform framework you can focus on writing code once for different platforms and it may have a native-looking interface on Windows, mac OS (OS X), and Linux at the same time! This feature is available for both Qt Widgets and Qt Quick.

The experts at the Qt Company created something more suitable for microcontrollers as wellΒ  – Qt Quick Ultralite. You can read about this in our blog post dedicated to First Steps with Qt for MCUs.

If you would like to explore further the differences between Qt Quick and Qt widgets or you want to get more familiar with GUI development, I encourage you to take at our detailed comparison between QML and Qt Widgets.

 

Why to Use Qt?

Uff, I think I’ve managed to sum up what Qt offers. However, just knowing about the framework is not enough, because you still have to want to use it at all. That is why I will try to discuss the advantages and disadvantages of Qt to make your decision easier. If you prefer the video form of such a comparison then I recommend checking our episode of Qt QML tutorial.

 

Qt Framework Advantages

Let me start with the advantages. The first one I have already mentioned is maturity. Qt is a framework with a long history, so the authors (and the community) have had a lot of time to improve it. This is particularly important in industries where the quality and stability of an application is more important than chasing the latest (often overhyped) framework.

Another advantage is versatility and efficiency. Thanks to Qt, we can implement functionalities from many areas and various industries and still be sure that everything will be highly efficient and well-optimized. This applies not only to advanced backend logic but also to creating modern graphical user interfaces.

A final advantage that may seem unimportant but I value it is the open-sourced nature of Qt. This approach guarantees that we can get to know exactly how a solution is written (we can easily look at Qt source code) and, if necessary, even compile Qt ourselves!

 

Qt Framework Disadvantages

However, so that it is not the case that I am blindly fixated on Qt and only praise it, I will mention a few drawbacks. The first is the rather high entry threshold. Using Qt, you need to know at least the basics of C++, which is considered to be quite a complicated language. In fact, most of Qt objects, classes, and general offering is also available in Python.

Another disadvantage is some of the tools that come with Qt. For example, Qt Creator is not as polished as competing IDEs for other languages (but it gets better with every update), and Qt Design Studio, in my opinion, is neither for designers nor for developers (the quality of the generated code leaves a lot to be desired).

The final disadvantage that I think is the most severe is the licensing of Qt. Most Qt modules are available under open-source licenses, but some of them (for example Qt Charts for the implementation of graphs) already require the purchase of a commercial license, which is not the cheapest. The licensing is quite complicated and not clear in many cases, but you still can use Qt for free and earn if you are compliant with LGPLv3 license obligations. See our website about Qt licensing for your project to learn more. The commercial license is not a must!

 

Scythe Studio Qt success stories

At Scythe Studio, Qt is the main technology that we use in projects for our clients. Therefore, I thought it would be interesting to show you some examples of Qt applications we have completed using Qt.

 

Qt Automotive Cockpit

The first example I wanted to mention is a Qt project we wrote for a customer from the automotive sector. The company we worked for was developing innovative electric cars with an extensive control cockpit.

The application ran in the cockpit of the car and was controlled using touchpads built into the steering wheel. We implemented elements that are most commonly found in modern cars: speedometer, navigation, control panels for controlling car options, and the entire IVI cockpit. If you would like to read more, please check out our Qt Automotive cockpit case study.

Qt automotive

 

Custom Medical Software for Spinal Surgery System

Let us now change to a slightly different industry namely medical. One of our medical projects was an application used to plan and carry out spinal operations. In this case, thanks to Qt, we were able to create a GUI for medical staff. In this application, we primarily had to implement support for the DICOM file format, which is used to represent scans from computer tomography or X-ray images. It was also an opportunity for us to delve a little deeper into the world of the modern medical industryπŸ‘¨β€βš•οΈ.

medical device

 

Patient Monitoring System

Another Qt project from the same sector was an application for monitoring the breathing of a patient who was lying on a hospital bed. This application presented the results on a screen next to the patient’s bed, so that the doctor or nurse could monitor the patient’s parameters in real-time.

I wasn’t personally involved in the project but you have to trust me that when the guys working on the project showed how it worked it was impressive!

 

Qt Mobile App for Blood Analysis Device

The last project (strangely also a medical one) I wanted to mention was a small device for conducting rapid blood tests. This device was no bigger than a coconut πŸ₯₯ and was controlled by a mobile app! Due to the lack of any buttons or control panels on the device, the user-controlled everything from his smartphone. This also shows us how interesting it is to mix different technical solutions!

Qt mobile

A little one and so much he can do!

As you can see quite a few of the projects were from the medical sector. If, by any chance, you are reading this as a medical professional, I encourage you to take a look at our page about the development of applications for the medical industry.

Qt’s Top Case Studies

Just so that we are not just bragging about our achievements πŸ˜‚ , I have also decided to highlight for you some recognizable companies or applications that also use Qt software.

 

Mercedes-Benz

Qt has made its mark in the automotive industry, particularly at companies like Mercedes-Benz.

Mercedes utilizes Qt to craft sleek and cohesive in-vehicle infotainment systems and interfaces. Qt’s cross-platform capabilities allow for consistent and user-friendly experiences across different car models and operating systems. This versatility enables Mercedes-Benz to efficiently develop, test, and implement software that aligns with its reputation for luxury and innovation in the automotive realm.

automotive cockpit

Source

 

AutoDesk Maya

Qt has also become a valuable asset for Autodesk Maya, a 3D animation and modeling software. Maya employs Qt to create a unified and user-friendly interface for its complex 3D design and animation tools. Qt’s cross-platform capabilities ensure a consistent user experience across various operating systems. This flexibility empowers Autodesk to streamline software development, testing, and deployment, ultimately enhancing the functionality and user-friendliness of Maya for 3D artists and animators.

where qt is used

Source

 

KDE Plasma

KDE Plasma, an open-source desktop environment, relies on Qt as its foundation. This collaboration with Qt allows KDE to build a cohesive and user-friendly interface for Linux and Unix-based operating systems. Qt’s open-source nature aligns perfectly with KDE’s commitment to open-source software, fostering a strong partnership that promotes innovation and customization in the Linux desktop environment.

This synergy results in a flexible and visually appealing user interface for Linux users while promoting open-source values and collaboration within the community. I’m sure The Qt Company owes a lot to KDE and the entire free software community.where qt is used

Source

 

Learn Qt now!

As you can see for yourself, Qt is an extremely interesting technology. If I have already managed to encourage you to use it but you are completely unfamiliar with it, that’s okay. Scythe Studio’s brightest minds have prepared a tutorial on YouTube aimed precisely at complete novices.

I heartily recommend that you take a look at it. And once you’ve watched it, don’t hesitate to leave us some feedback – every comment is valuable to us!

Qt tutorial

 

Summary

This blog post was probably the longest I have written, but the topic itself was extremely broad. At Scythe Studio we deal with Qt daily and it is extremely difficult to include all the information about it in just one post 😡. However, I hope I managed to get you interested in Qt cross-platform development and answer your questions. There will certainly be another post soon, so stay tuned!

Scythe-Studio - Qt Developer

Jakub Wincenciak Qt Developer

NeedΒ QtΒ QML developmentΒ services?

service partner

Let's face it? It is a challenge to get top Qt QML developers on board. Help yourself and start the collaboration with Scythe Studio - real experts in Qt C++ framework.

Discover our capabilities

Latest posts

[ 94 ]