Computer software sometimes has a requirement for generating random numbers. Applications include games, simulations, cryptocurrency, and security software. Generating true random numbers is surprisingly difficult, and many applications use a series of pseudorandom numbers, sometimes seeded with an initial value that is not constant, such as user input or the current time or date.The ISO standards for the C and C++ programming languages and other standards, such as POSIX, define standard random library functions. The most well-known are probably the rand() and srand() functions.Since Qt…
You have probably used the QTimer class for basic timing operations in Qt. Common use cases include polling for events (not always a good approach, but sometimes necessary), updating the user interface or performing some other function at regular intervals. And you probably know about the repetitive and single-shot modes of QTimer timers.In this blog post we'll look at some of the other timer classes provided by Qt that you may not be familiar with if you've only use a simple QTimer.Before doing that, I'd like to point out a feature of QTimer you may not be aware of. Through the timerType…
classDiagram
Rectangle <-- `Graphical Application`
GUI <-- `Graphical Application`
Rectangle --> GUI
Rectangle --> GeometricRectangle
`Computational Geometry Application` --> GeometricRectangle
class Rectangle {
+draw()
}
class GeometricRectangle {
+area() double
}
class `Graphical Application`:::app {
}
class `Computational Geometry Application`:::app {
}
class `GUI`:::app {
} classDiagram
Rectangle <-- `Graphical Application`
GUI <-- `Graphical Application`
Rectangle --> GUI
Rectangle --> GeometricRectangle
`Computational Geometry Application…
It is often desirable to log events from an application, like errors or debug information, to a log file or even to a different computer. A new feature of Qt in version 5.6.0 is the ability to direct the output of the commonly used Qt message logging functions to the standard syslog and journald logging systems available on most Linux platforms.In this blog post, we'll look at how to use this new facility, including example code. We'll also look at how you can implement this using a custom message handler so you can support different logging back ends, even with versions of Qt…
Developers often have a desire to speed up their code to make it run more quickly. Some well-known advice on this topic, attributed to the programmer Michael A. Jackson, says:Rules of Optimization:Rule 1: Don't do it.Rule 2: (for experts only) - Don't do it yet.Sometimes a third rule is added:Rule 3: Profile before optimizing.The key point here is not to optimize your code until you have a correct, clearly written, and unoptimized solution. Then, use tools to identify where the bottlenecks are and focus on them. Software performance often follows a so-called 80/20 rule where 20% of the code…
In an earlier blog post (1) I described how to create a widget with a Qt Designer plugin interface so it can be viewed within Qt Designer. With the increased interest in using Qt from the Python programming language, I asked one of our developers to reproduce the same example, but implement the widget in Python with PyQt. Not all the steps to do this are obvious so I'll walk you through.Example FilesThe download link (2) contains the example code referenced in this blog post. It includes the following source files:ledwidget.py: A port of the earlier LED…
My recent blog post covered how to set up Qt and Qt Creator on a Windows 10 system. In this post I'll look at how to configure a Linux system for Qt desktop development.Since the set up process on Linux is almost identical to that on Windows, rather than repeat the information I refer you to that blog. (Keep it handy, you'll need it later.) In this post, I'll cover the differences.Assumptions and PrerequisitesFor this example I will assume you want to install Qt 5.6.0 or 5.7.0 on a recent release of Ubuntu Desktop Linux. The procedure will be similar with other Linux…
Two earlier blog posts (1) (2) covered how to set up Qt and Qt Creator on Windows and Linux systems. Let's look at installation on the remaining major desktop platform, macOS.Thanks to the unified Qt installer, the process is very similar to that on Windows and Linux, so we'll just cover some of the differences and highlights of the Mac install.Assumptions and PrerequisitesFor this example we'll install Qt 5.7.1, which is supported on macOS version 10.8 and later.The C++ compiler used by Qt on macOS is the Clang compiler, provided as part of the Xcode development tool. You will need to…
Editor's note: This 2019 blog series, among ICS' most popular, has been updated (December 2022) to ensure the content is still accurate, relevant and useful. This blog launches Integrated Computer Solutions' (ICS) new series on GPIO programming. GPIO, or General-Purpose Input/Output, is a feature of most modern embedded computer hardware and a key component of many embedded systems. In this series, I'll cover this important aspect of embedded programming, with a mix of theory and practical programming examples. In this first installment I'll present an…
Originally published in 2018 with a focus on Qt 5, this post has been updated in 2025 to reflect the current state of input masks and validators in Qt 6.Handling user input gracefully is crucial for building polished, user-friendly applications. In this blog post, we’ll dive into how Qt helps manage text input using input masks and validators — two powerful features designed to prevent errors before they occur. We’ll focus on how these tools work with traditional widgets, specifically the QLineEdit class, and explore how they can help control and validate user input.A Closer Look at Qt's…
Here’s how I built a secure, rules-driven translation tool for air-gapped environments, using AI to speed code migration without ever connecting to the cloud.Do electric sheep know Motif?I’m a software engineer who has worked across desktop apps, embedded systems, and defense projects. As a former Navy Missile Technician, I’m used to environments where precision and security are non-negotiable. That mindset shaped my approach when I was tasked with porting legacy Motif code, a GUI toolkit from the late 1980s, into the modern Qt framework.On its own, porting decades-old UI code is a serious…
The Single-Responsibility Principle (SRP) is the first of the five SOLID principles of object-oriented design intended to make object-oriented designs more understandable, flexible, and maintainable. Originally described by Robert “Uncle Bob” Cecil Martin in March 1995 on the comp.object newsgroup as a part of “The Ten Commandments of OO Programming”, the five principles are S - Single-responsibility; O - Open-closed; L - Liskov Substitution; I - Interface Segregation; and D - Dependency Inversion.In this blog, I will focus on the “S” – the Single-Responsibility Principle.What is…
While technologies come and go in the software industry, some have stuck around for a very long time. One notable example: The X Windows System, and with it the Motif widget toolkit. In use since the 1980s, X Windows was the first windowing system environment to offer true hardware independence. For its part, Motif has long been embraced in industries that require stability and longevity, such as financial services and aerospace. It has even been seen on the silver screen in such movies as Men in Black and Jurassic Park. Despite this storied existence, eventually all good things must…
In the realm of software development, choosing the appropriate framework is paramount to project success. When considering cross-platform application development, two prominent options are Qt and Flutter. Qt, established pre-1995, boasts a robust toolkit built on C++, providing versatility beyond graphical interfaces and catering to complex project requirements. In contrast, Flutter, introduced by Google in 2017, has garnered attention for its rapid development capabilities and cost-effectiveness, making it particularly appealing to budget-conscious developers.This comparison between the…
Increased complexity.That’s the overarching takeaway from the 2024 Embedded World Exhibition & Conference, held April 9-11 in Nuremberg, Germany. Embedded World brings together the global embedded community – last year more than 950 exhibitors and 27,000 visitors participated – and provides a unique view of the latest technologies, trends and challenges impacting this versatile industry. “With the growing prominence of the industrial internet of things (IIoT), we’re no longer talking just about devices, but rather systems of devices,” said Integrated Computer Solutions (ICS) CEO…
In this series on BLoC for Flutter, we’ve examined differences between reactive and traditional programming methods, explored the BLoC architecture, and learned about BLoC widgets. (If you missed it, read Part 1 - Discover BLoC Pattern and Part 2 - A Deeper Look at BLoC Pattern.)
In this installment, I’ll explain how to conduct unit tests with BLoC. This is a critical step in the development process because unit tests can have many unpredictable bugs. Particularly in reactive programming constructs, the code is a bit harder to understand and therefore more error-prone. Let's get started.…
Continuing our series on building with CMake, in this installment we’re taking a look at how to create a library that others can use for their own applications. (If you missed the earlier installments, part 1 shows how to make a simple application, while part 2 explains how to find libraries to use in your application.)
When we create a library that others can use, we ensure the library is platform-agnostic and does not restrict the compiler or operating system. While these are important requirements, they do create a few issues – one being operating system differences and another being the…
For most of our work on embedded devices, the setups are typically quite static: the main board, a display with known resolution, some sensors. But sometimes there is a requirement that shakes up the status quo. On one recent project, that was definitely the case. The customer said “We have an LVDS display, but we want the user to be able to plug in an HDMI monitor at any time and provide a mirrored display of the application.”
Though the request was straightforward, it was not simple. Here’s why.
Back in the days of the X server accomplishing this was not a big deal. Just create…
In part 1 of this two-part series on the Bloc Pattern for Flutter, I defined the Business Logic Components (BloC) pattern as a reactive pattern that separates an application's business logic from its UI logic. The purpose is to make the code easier to maintain and test. I also provided some insight into reactive programming and how it differs from traditional, event-driven programming.
In this installment I’ll dive deeper into the BloC Pattern, exploring various aspects, such as BloC Provider and BloC Builder, and share with you some code examples to help you better understand this important…
In Part 1 of our series on CMake, an open-source, cross-platform family of tools designed to build, test and package software, I provided an overview and showed you how to build a basic CMake project. In today’s Part 2, I’ll show you how to find libraries and link them to your application.
When working on almost any code project you’ll probably want to use another library. There are several kinds of libraries you may need to use. Here’s a look at different types of libraries, and insight on how to use them within an example CMake project.
Libraries can either be compiled within your source…
As developers know, design patterns are crucial to the success of code. If you are a new Flutter developer, you may have encountered patterns such as MVVM. BLoC – or Business Logic Components – is a reactive pattern that separates an application's business logic from its UI logic. The purpose is to make the code easier to maintain and test.
BLoC works based on a library. The BLoC pattern at its core handles asynchronous events and creates a continuous flow with a reactive programming approach. Reactive programming refers to a design paradigm that relies on asynchronous programming…
CMake is an open-source, cross-platform family of tools designed to build, test and package software. According to the CMake website, CMake is used to "control the software compilation process using simple platform and compiler-independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice."
It is widely used because CMake allows developers to more easily create, tailor and test software by simplifying some of the most challenging aspects of the process, including system introspection and executing complex builds.…
Wednesday, January 18, 2023 - 08:05
">
•
By Stephanie Van Ness, Jay Noble
•
Testing, Software Development
The key to effective software testing is striking the right balance between automation and manual testing methods. Automation testing, in which the test case is executed by a tool rather than by a human, represents 80% of the software testing market according to Absolute Reports, in large part because it is highly accurate.
Still, there are many situations that call for manual testing. Though it may not always be as accurate as automation, the inclusion of human decision-making in the process provides greater flexibility. For certain types of tests, like usability testing, human testers can…
Thursday, October 20, 2022 - 08:32
">
•
By Jay Noble, Stephanie Van Ness
•
Testing, Software Development
Software testing improves the quality of the product, increases user satisfaction, promotes security, and mitigates costs by identifying defects early when they are less expensive to fix.
But the road to successful software testing can be filled with potholes. From tight deadlines and unstable test environments to last-minute requirements changes and a lack of skilled testers, there are obstacles around every turn. In this blog we focus on one of the least technical – but arguably one of the most critical – obstacles facing software testing teams: poor communication.
Effective…
It is not uncommon for software developers to be involved in more than one project at a time, or need to set up an old project to check a change. Some projects might require a specific OS, or availability of one or more SDKs or libraries. A virtual machine might come handy in these cases. But virtual machines come with drawbacks: they run yet another kernel with a subset of the main system’s cores and RAM. And keeping a full image around for documentation purposes is suboptimal.
To better handle this type of scenario, including containers on embedded devices, I have been using Docker and…
Qt developers are a passionate bunch. They love to talk about new features, new versions. How cool is this and what needs to be done with that. And it all makes sense. New features and new versions are, eh, new and exciting.
The essential part of Qt though is taken for granted. Most of the time, it does not get the recognition it rightfully deserves. (Here’s a list of what is considered essential, and what are considered add-ons.)
I was working on an interesting project lately. A cross-platform, server side application that can receive messages, create events and redistribute…
Part of my job is to prepare Yocto setups for our customers' devices. My goal is twofold: set up an environment a client can easily reproduce; and ensure this environment also allows developers to have multiple projects at the same time. In this blog post I explore the workflow I use in order to achieve this goal.
The recommended way of creating a successful Yocto environment is by using a well-tested OS. That means either installing a specific OS or resorting to some form of virtualization. While the first option is valid, it might get complicated for a developer to handle if a different…
As The Qt Company has shifted its focus from qmake to cmake, it is time to revisit a previous blog post on the Qt Installer Framework. The post presented a small qmake example in which the generation of an application's installer was part of its build.
Today, I'll illustrate how to do the same thing with cmake. It turns out that the process is simpler.
CMake's cpack module
To generate a binary installer or distributable source packages, cmake has the cpack module. As is illustrated in this short video, in its simplest form on Linux, running in the build directory, the set of commands…