As a developer, you're probably familiar with the concept of Design Patterns [1], but you may not have heard of the term anti-pattern. First coined by Andrew Koenig, the term anti-pattern or AntiPattern [2] refers to a commonly used programming practice that has proven to be ineffective, inefficient, or otherwise counterproductive. Anti-patterns commonly arise as solutions to problems that, while initially appearing to be appropriate and effective, have been found in practice to have more negative consequences than positive ones. Documenting anti-patterns can help programmers avoid such…
Tuesday, November 25, 2025 - 17:01
">
•
By Jeff Tranter
•
Application Analytics, Google Analytics, Qt, QML
A previous blog post (1) described how we've been using Google Analytics at ICS to collect usage information for a Kiosk application. In this second blog post, I'll present more technical information about how to use Google Analytics from C++ code and how Qt makes this very easy to implement.Administration of Google Analytics (2) is done through a web browser. Once you've signed up, you need to create a project. You will be given a unique tracking code to use when recording events so that you and others can see the data from the web interface.The Google Analytics Measurement Protocol defines…
Every Qt developer should be familiar with the common tools like qmake, Qt Designer and Assistant, but looking in your Qt installation's bin directory will reveal a few more programs there. In this and future blogs, we'll look at some of the lesser known Qt development tools.First, let's review a list of the tools for which you should be familiar. A few, like moc, rcc, and uic may be less familiar to you if you primarily let qmake or your IDE take care of building software, but the tools shown in the table below are ones that most Qt developers use on a regular basis.Table 1 -…
For years C and C++ have been the dominant system programming languages, especially for high-performance and embedded applications. While I don't think that will change any time soon, there is an interesting alternative that has been increasingly growing in popularity: Rust. Let's take a look at this up-and-coming programming language and what you need to know about it.About RustRust is a compiled language, with performance comparable to C++ and a syntax that is also similar to C++. It is suitable for much of the same problem domains as C++: systems programming and the development of…
Tuesday, November 25, 2025 - 16:48
">
•
By Jeff Tranter
•
Qt, QML, qmlscene, QML tooling, QML run-time
A new feature in Qt version 5 is an executable program similar to qmlscene that can execute QML files. It is sometimes referred to as the QML Tooling or QML Run-time, although both of these terms are sometimes used to refer to other aspects of QML. A few colleagues mentioned to me that they were not familiar with this feature of Qt, so I thought it would make a good topic for a short blog post.The program is called qml. Unlike qmlscene, it supports the standard shebang (1) feature of Linux, UNIX and other POSIX systems that allows specifying the interpreter to run a program. By…
In this post, part 8 in our series on GPIO programming, we'll look at libsoc, a cross-platform library intended for low-level embedded programming, including GPIO. (If you missed part 7, read it here.)Libsoc [1] is a C library to interface with common peripherals found in System on a Chip (SoC) devices under Linux. It is generic and should be compatible with any SoC that has Linux drivers exposing the interfaces for the peripherals. It is written in C and has a native C API with a subset of the API supported with Python bindings.The basic features are the following:GPIO manipulation through…
Tuesday, November 25, 2025 - 16:41
">
•
By Jeff Tranter
•
Qt, QML, OProfile, performance, profiling, tools
As a developer, there are a number of useful tools that you always want to have in your arsenal for testing and debugging. This includes debuggers, memory checkers and performance profilers.In this blog post I would like to present some information about a profiler tool that I feel deserves more recognition: oprofile.What It DoesOprofile (1) is an open source tool for statistical performance profiling. It runs on Linux systems and uses the hardware performance counters of the CPU to perform profiling of code with low overhead. It allows all code to be profiled including applications,…
I've mentioned the Yocto (1) embedded framework in previous blog posts. Some people may have shied away from trying it because they have heard it has a steep learning curve. While Yocto is complex, it is very easy to get started and you can do so without any embedded hardware.In this post I'll present a series of step-by-step instructions for building the Yocto-based Poky Linux distribution and running it under the Yocto emulator. The build environment will be Ubuntu desktop Linux but it should work much the same on any desktop Linux system. I've tested this on an Ubuntu 14.04…
The Qt Speech module was introduced in Qt 5.8.0. I made a blog post at that time (June 2017), looking at how it provided cross-platform support for text-to-speech. With the Qt 6.0.0 release, Qt Speech was one of the modules that were no longer available. In the upcoming Qt 6.4.0 release, it is again going to be part of Qt.FeaturesQtSpeech provides cross-platform support for real-time text-to-speech output. It uses platform-specific back ends to do the actual speech generation and is supported on the Linux, macOS, Android, and Windows platforms.Common use cases for text-to-speech are to…
Qt 6.5.0 is hot off the presses! Here's a look at what is new and significant in this release, from a new tool to create shader effects for Qt Quick to Qt QML Core, a new module that exposes Qt Core APIs to QML. Qt Release HistoryThe Qt 6.5 release effort started around November of 2022 with a platform and module freeze, moving to three beta releases and a release candidate until 6.5.0 final was released on April 3, 2023. Qt 6.5.0 is one of the twice-yearly major Qt releases. The 6.5 series will be a long-term support (LTS) release, supported until Q1 of 2026. The previous LTS is…
In this blog post, the last in the series, I'll cover the remaining Qt command line tools as there are only a few programs we have not already discussed.xmlpatterns and xmlpatternsvalidatorThese two XML-related tools are for working with Qt's XQuery support. XQuery is a query and functional programming language for querying and transforming collections of structured and unstructured data.The xmlpatterns command is a tool for running XQuery queries. The xmlpatternsvalidator program is used for validating Qt XML Patterns.As a piece of useless trivia, xmlpatternsvalidator ties with…
Download the entire webinar series.What is Qt's take on T2S applications?Assuming this refers to TARGET2-Securities, the European securities settlement engine, I don't know of anything relevant in Qt except possibly the Qt Purchasing API which supports In-App Purchases, but could potentially support other financial features in the future. Does the += mean to add to the existing variable definition?In the context of the QString class, the += operator is overloaded to perform string concatenation. Several other classes also overload this operator. See the Qt documentation under…
Sometimes an application needs to use different assets, such as graphics images or QML files, depending on the platform that the application is running on.One way to do this is with conditional code at compile time using the C++ pre-processor (i.e. #ifdefs). It can also be done with conditional code that loads different files at run-time, depending on the platform.Qt provides a nice facility to handle this in a more elegant way: file selectors. In this blog post. I'll look at what Qt provides, for both C++ and QML, and show a simple but complete program example.QFileSelectorAt the C++…
In this blog post, I'll present a few tips and tricks for using Qt of which you may not be aware. These are small topics that I didn't feel justified an entire blog post of their own and were collected by polling the ICS Qt consulting team.Qt ExtrasThere are platform-specific features available in the Qt "Extras" modules: Android Extras (1), Mac Extras (2), Win Extras (3) and X11 Extras (4).While it is always best to avoid platform-specific features whenever possible, these modules allow you to use some features of a specific platform from within Qt, avoiding the need to call the platform…
Monday, November 24, 2025 - 16:32
">
•
By Jeff Tranter
•
Qt, C++, localization, internationalization
In this blog post, we will show an example of how to support dynamic language selection in an application using Qt. By "dynamic", I mean that the application can change the displayed language from within the application at run-time, rather than picking it up from the locale once on startup.Text or ID-Based Translations?In this example we will be using the text identifier translation mechanism, which may not be familiar to you if you have only used Qt's more common string-based translation method using the tr() method.The ID-based method (1) is described as an "industrial strength"…
In this post we'll take a look at one of the newer Qt modules: Qt Speech.What Is Qt Speech?Qt Speech is a module providing cross-platform support for text to speech. It supports text to real-time speech output. Common use cases for text to speech include enabling software for visually impaired users and scenarios where users cannot utilize a touchscreen, mouse, or keyboard input, such as in-vehicle applications. The module may support other features, such as speech recognition, in the future.The Qt Speech module was first introduced in the Qt 5.8.0 release. As of Qt 5.9.0 it is…
Monday, November 24, 2025 - 16:29
">
•
By Jeff Tranter
•
Qt, development tools, virtualization, emulation, simulation
Various tools that can be lumped together under the category of simulators and emulators can be useful during development, especially for embedded systems. A number of products use virtualization to run one operating system on top of another one. This allows you to run Linux on top of Windows, for example, or vice versa.This is often useful for embedded development where you might want to develop on a Windows desktop, but need to run a cross-compiler or SDK that is only supported under desktop Linux.Virtualization allows you to run Linux in a virtual machine under Windows, and still have…
Memory and resource leaks are the stuff of nightmares for programmers. If a program doesn't properly free memory or other resources, it may appear to run correctly, but randomly crash or misbehave after working normally for hours or days. All too often, the problem is only discovered just before the application is supposed to be shipped to customers.While Qt helps somewhat with it's object model, resource leaks can occur with any programming language like C++ where the user is responsible for managing memory or other resources like file handles. Let's take a look at some of the tools that can…
Perhaps you have been trying to do more with QML than just using the basic elements like rectangles, text and images, or maybe you have been struggling to implement a user interface that doesn't map well into these basic elements. If so, the QML Canvas may be just the solution you are looking for. In this post, we'll look at Canvas (1), a powerful and useful QML element that is part of Qt Quick.IntroductionThe basic QML visual elements are quite low-level, consisting of things like images, rectangles and text. Often you can build your user interface by combining these basic building…
IntroductionThis blog posting gives an introduction to the Qt Graphical Effects module which is available in Qt 5. As of Qt 5.1 the module offers 25 QML components which support effects in these categories: blend, color, gradient, distortion, drop shadow, blur, motion blur, glow and mask.List of EffectsHere is the list of effects provided as of Qt 5.1:EffectDescriptionBlendMerges two source items by using a blend mode.BrightnessContrastAdjusts brightness and contrast.ColorOverlayAlters the colors of the source item by applying an overlay color.ColorizeSets the color in the HSL color space.…
Earlier this year, The Qt Company announced that Python would be officially supported in Qt via the Qt For Python (formerly PySide2) Python bindings and tooling. In June 2018, the first technical preview was offered, built against the Qt 5.11 release.I have some experience with Python, including using it with the PyQt Python bindings, so I thought I would take a closer look at how Qt for Python is coming along. In this blog post I'll share some of my thoughts and experiences with porting a real Qt application from C++ to Python.What Was DoneI decided to try porting a spreadsheet example…
In this blog post we'll look at a little-known feature of Qt that can make your applications more user friendly: the QCompleter class. QCompleter provides completions for user entry, based on an item model. It is supported by the QLineEdit and QComboBox widgets.When a user enters text, the completer suggests possible ways of completing it, based on a word list provided by the model. The model can be any QAbstractItemModel, or in the simple case just a QStringList of words. Typically you create a QCompleter object, passing a model in the constructor. Widgets that support a completer have…
Many programs need to accept command line options. For all but the simplest programs, the logic to validate and parse command line options can be significant. Support for handling this beyond what is provided by the standard C/C++ run-time library has been a long-missing Qt feature.While it may appear simple, it is surprisingly hard to develop a clean API that will be both easy to use and satisfy most users' requirements. After several failed attempts in the past, thanks to the efforts of Qt and KDE developer David Faure, command line parsing support is now in Qt 5.2.0. It was based…
Starting with version 8.0.0 the Qt Creator IDE has a useful new plugin that allows you to browse and clone projects from a GitLab server. While easy to use, it is not well documented, so I thought I would write a blog post that describes how to configure and use it.RequirementsYou will need Qt Creator version 8.0.0 (or later). You can identify the version from the menu entry Help / About Qt Creator...You will also need the curl program, which is typically installed by default on most Linux, macOS, and Windows 10 and 11 systems.Enable the PluginAs of Qt Creator version 8.0.0 the plugin is…
IntroductionQt 5 introduced a new set of multimedia APIs. Both C++ and QML APIs are provided. In this blog post, I will give an overview of the QML APIs for multimedia.Multimedia QML ElementsThe QtMultimedia module provides the following QML components:NameDescriptionVideoA convenience type for showing a specified videoAudioAdd audio playback to a sceneMediaPlayerAdd media playback to a sceneCameraAccess viewfinder frames and take photos and moviesCameraCaptureAn interface for capturing camera imagesCameraExposureAn interface for exposure related camera settingsCameraFlashAn interface for…
IntroductionWith most C++ compilers now providing good support for the latest language standard, C++11, let's look at some of the new language features that are particularly useful for use in Qt programs. I won't cover all the new C++11 features; just some that in my experience are particularly useful when programming with Qt. See the references at the end if you want more details.Enabling C++11 Compiler SupportSome compilers need command line options to enable C++11 support. If you are using qmake as your build system, adding the following line to your qmake project file should produce a…
IntroductionQt Quick's QML language makes it easy to do many things, especially fancy animated user interfaces. However, some things either can't be done or are not suitable for implementing in QML, such as:Getting access to functionality outside of the QML/JavaScript environment.Implementing performance critical functions where native code is desired for efficiency.Large and/or complex non-declarative code that would be tedious to implement in JavaScript.As we'll see, Qt makes it quite easy to expose C++ code to QML. In this blog post I will show an example of doing this with…
Thursday, November 20, 2025 - 11:52
">
•
By Jeff Tranter
•
Qt, Qt Creator, QML, Widgets, C++, IDE, Windows
Feedback from our recent Qt for Beginners webinar series indicated a need for some basic tutorials for beginners. If you struggle with initially getting Qt set up for development with the Qt Creator IDE and a C++ compiler, this post is for you. I'll walk you step by step through the process of getting a Qt development environment running on Windows, providing lots of screen shots to guide you.Assumptions and PrerequisitesFor this example I'll assume you are running Windows 10. We will install the Open Source version of Qt 5.7.0 using the MinGW C++ compiler and the Qt Creator…