Tuesday, November 6, 2018 - 10:20  •  By Jeff Tranter  •  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…
Monday, November 5, 2018 - 16:04  •  By Jeff Tranter  •  Qt
I just got back from Qt World Summit 2018, held at The Westin Boston Waterfront Hotel. The sold-out show drew more than 450 people. This was the first time the North American show was held on the East Coast since 2003. For Integrated Computer Solutions (ICS) the location was ideal, as our head office is in the Boston metro area. Keynotes and Training Sessions This year the schedule was compressed, with an optional training day offered on Monday, followed by the conference proper on Tuesday. Training day offered 11 half- and full-day courses, six presented…
Tuesday, September 18, 2018 - 10:24  •  By Jeff Tranter  •  Qt
If you've used Qt to develop widget-based applications, you almost certainly used Qt Designer to lay out screens or dialogs and then used the Qt User Interface Compiler (uic) program to generate the C++ code for the user interfaces. You may not be aware of another approach supported by Qt: generating user interfaces dynamically at run time using the Qt Designer UI files. In this blog post we'll look at how this is supported by the QUiLoader and QFormBuilder classes in Qt. QUiLoader The QUiLoader class allows you to dynamically load a Qt Designer user interface (ui) file and…
Wednesday, September 5, 2018 - 14:47  •  By Jeff Tranter  •  Qt
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…
Tuesday, July 31, 2018 - 12:19  •  By Jeff Tranter  •  Qt, Python
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 Done I decided to try porting a spreadsheet example…
Monday, June 4, 2018 - 10:28  •  By Jeff Tranter  •  QML
In a previous blog post I described how to use Qt's facility for input masks and validators in widget-based applications. In this installment I'll look at the corresponding support in QML. Input Masks The QML TextInput and TextField types have similar support for input masks as the QLineInput widget. TextInput is a QML type built in to Qt Quick (available when you import QtQuick) and TextField is a more sophisticated type that is included as part of the Qt Quick Controls 2. There is also support for input mask in the TextField type from the Qt Quick Controls 1, but these are now…
Monday, June 4, 2018 - 10:25  •  By Jeff Tranter  •  Widgets, Qt
In this blog post, part of a series on Qt basics, I'd like to explore Qt's support for input masks and validators. In this first part we'll look at the support from widgets. In a future installment we will see how these features are supported from QML. Overview A general principle of good UX design is to prevent users from making errors in data input. Rather than reporting invalid input that a user has entered after the fact, a better practice it to design an interface that prevents the user from entering invalid data in the first place. While this is not always possible, the use of…
Friday, May 25, 2018 - 15:04  •  By Boris Ralchenko  •  Qt
Last week, I introduced you to ZeroMQ, a high-performance asynchronous messaging library, aimed at use in distributed or concurrent applications. Now, I’ll show you how to actually build a library from source code. Building a Library from Source Code Our best resource is http://zeromq.org/build:iphone with its instructions on how to build the library for iOS. Or not. The problem is that these instructions are outdated. For instance, the script asks for iOS 5.0 and XCode 4.3.3. The current iOS version is 11.3.1 and the latest version of XCode is 9.3. Clearly the information has not…
Thursday, May 24, 2018 - 12:18  •  By Jeff Tranter  •  Qt, C++, QML
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…
Friday, May 18, 2018 - 14:55  •  By Boris Ralchenko  •  Qt
Are you a Qt developer interested in creative ways to build a messaging service for your app? If so, this blog is for you. I’ll introduce you to ZeroMQ and show you what you could do in Qt to implement messaging in your application. Here’s why you should you care about ZeroMQ: It speaks your language in terms of both usage patterns and programming language. While you can do almost everything in terms of Server/Client, it’s more convenient to think in terms of Publisher/Subscriber if that’s what you are after. It's distributed by design and does not require single message broker. That’s…
Friday, May 18, 2018 - 07:33  •  By Jeff Tranter  •  Qt, Training
As a follow-up to my blog post on Qt Books, here are some other great resources for learning Qt. Different people learn in different ways and at different paces. The various training resources I've listed here should accommodate you whether you're looking for an intensive week of formal training or just desire to brush up your knowledge in your spare time. Training Material The official Qt training material used by ICS and other training partners of The Qt Company is available [1] from a github repository. This includes PowerPoint slides for the training modules, as well…
Friday, May 18, 2018 - 07:26  •  By Jeff Tranter  •  Qt, Python
Qt has always been renowned for its excellent developer documentation that includes API reference information as well as tutorials and examples. But some people prefer documentation in book format, whether it be an e-book or a traditional printed paper volume. Books offer a different style of presentation from formal documentation that can be better suited to learning, and they offer portability with the convenience of not needing to be at a computer to read. Whether you are on a long airplane flight or at the summer cottage, a book can be an opportunity to relax and learn at the same…
Wednesday, February 21, 2018 - 11:26  •  By Vy Duong  •  Qt, macOS
In this blog post we'll explore the basic steps to deploy a Qt application for macOS, including assigning an icon for the application and adding assets. It is assumed that you have Qt Creator and Qt version 5.7.1 or later installed and configured on your macOS computer. If not, this blog can be used as a reference point. Getting Started The first thing to understand is the structure of a macOS application. MacOS makes use of the concept of bundling. Mac applications are technically folders with .app extensions. From a normal user's standpoint from the GUI, it is a single…
Wednesday, January 17, 2018 - 12:51  •  By Jeff Tranter  •  Qt
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…
Friday, December 22, 2017 - 12:07  •  By Jeff Tranter  •  Qt, development tools
In this final installment of our Qt Developer's Bag of Tricks series, I'll look at some helpful tools that didn't fit into any of the categories covered previously. GammaRay GammaRay (1) is a tool for examining and manipulating the internals of Qt applications at run time. Unlike conventional debuggers, it understands the implementation of Qt, allowing it to visualize application behavior at a higher level, including signals, slots, properties and even scene graphs, model/view and state machines. It is free software, licensed under the GPL. A screen shot is shown below, being…
Thursday, December 21, 2017 - 16:25  •  By Jeff Tranter  •  Qt, development tools, IDE
While you can develop software using just a text editor and the command line (and many people do), you'll often see productivity gains by using a graphical integrated development environment (IDE). Here are a few options for IDEs that are suitable for Qt development. Qt Creator The "official" Qt IDE, Qt Creator (1) is open source, cross-platform, and written using Qt. It is usually the IDE of choice for Qt development unless you have some special requirements or a personal preference. Its support for mobile and embedded platforms really pays off in making it easy to build, deploy, and…
Wednesday, December 20, 2017 - 13:44  •  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…
Wednesday, December 13, 2017 - 10:40  •  By Jeff Tranter  •  Qt, Qt Creator
As 2017 draws to a close, I'd like to take a look back at some of the significant events of the past year that are relevant to the Qt framework and the ecosystem around it. Qt Releases The Qt Project continued to follow the process of generating two minor releases per year. Qt 5.9.0 was released on May 31, with subsequent patch releases for 5.9.1, 5.9.2, and 5.9.3 during the course of the year. Note that the 5.9 series is a Long Term Support (LTS) release, with a promise of support for three years. The previous LTS series was 5.6, which is still being supported. The current version is…
Tuesday, November 28, 2017 - 11:37  •  By Jeff Tranter  •  Qt, Embedded, development tools
In the past, embedded systems often ran very small operating systems with no filesystem, or even ran on the "bare metal." With the increasing power and lower cost of hardware, including SOCs (Systems on a Chip), many embedded systems are moving to a full operating system, often based on Linux. One advantage of running Linux on an embedded device is that many of the tools and utilities you are familiar with on a desktop Linux system are available in this environment, as well. While the final product may not ship with them, as a developer you can have access to a shell, basic commands,…
Monday, November 6, 2017 - 14:41  •  By Jeff Tranter  •  Qt, development tools, static analysis
Static Analysis (1), or more correctly, Static Program Analysis, is a method of analysis of computer software that is performed by examining source code without actually executing it. It is typically performed by automated tools. Static analysis is increasingly used in the development of safety-critical software, such as medical, nuclear and aviation systems. In this installment of our series on software development tools, today we look at some options for static analysis, focusing on those that support C++. CppCheck Cppcheck (2) is a static code analysis tool for the C and…
Wednesday, November 1, 2017 - 14:27  •  By Jeff Tranter  •  Qt, development tools, leaks
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…
Wednesday, October 25, 2017 - 09:35  •  By Mark Hatch  •  Qt, Qt World Summit, UX Design, auto IVI
We’re back from another successful Qt World Summit in Berlin, which boasted the largest crowd (1000+) to date. The popularity of the conference is a strong indicator that the Qt community continues to grow as does the number of commercially available products built with Qt. Our booth alone showcased a touchscreen sonar and navigation device for the marine industry, a home mechanical ventilator for respiratory support, a fully integrated, intelligent infusion pump, and a modern and elegant IVI system.  Thanks to everyone who stopped by our booth — and congratulations to our iPhone X…
Tuesday, October 17, 2017 - 12:35  •  By Jeff Tranter  •  Qt, WebGL plugin, 3D rendering
An interesting feature coming in Qt 5.10 is a new Qt back end that uses WebGL for rendering. It allows Qt applications (with some limitations) to run in a web browser that supports WebGL.  What Is it? The new back end uses WebGL, which stands for Web Graphics Library. WebGL is a JavaScript API for rendering 2D and 3D graphics within any compatible web browser without the use of plug-ins. The API is similar to OpenGL ES 2.0 and can be used in HTML5 canvas elements. The new back end will be introduced as a technical preview feature in Qt 5.10.0 and is included in the Alpha and Beta…
Monday, October 9, 2017 - 09:31  •  By Jeff Tranter  •  Qt, development tools
Continuing our Qt Developer's Bag of Tricks series, this time I'll give you an overview of some applications that come under the general category of tracing. (I'll also include some test coverage tools here too since they don't fit in any other categories in this blog series.) Tracing is often an effective and efficient debugging technique that doesn't require as much effort as using a debugger. It can be particularly useful for programs that you didn't write and don't have source code for. If a program crashes or hangs, tracing it may quickly identify the cause of the problem. Strace…
Monday, September 11, 2017 - 10:08  •  By Jeff Tranter  •  Qt, profiling development tools
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…
Friday, August 11, 2017 - 14:06  •  By Jeff Tranter  •  Qt, debugger, development tools
Experienced software developers tend to build up a set of tools that they find indispensable for development, testing and debugging. But if you ask a group of developers what their "go to" tools are for various tasks, it is surprising how different the answers can be. I've also found that many developers are unaware of some very useful tools that can save hours of effort. In the Qt Developer's Bag of Tricks series, which kicks off with today's post on debuggers, I'll cover several tools that the development team here at ICS has found useful. Scope Software development…
Thursday, July 20, 2017 - 00:30  •  By Chris Cortopassi  •  QML, Qt, controls
Continuing our QML Controls from Scratch series, this time we will implement a vertical ScrollBar, which is the vertical line segment you often see on the right of a touch user interface as you scroll vertically through a list of items. ScrollBar is quite a bit different than the other controls in this series as it can't be run stand-alone in qmlscene. Rather, it is designed to be a direct child of a ListView or GridView (the ScrollBar's parent). The ScrollBar's position (y) and height are computed with a bit of math, based proportions of Flickable's contentHeight and contentY, as…
Thursday, June 29, 2017 - 09:10  •  By Mark Hatch  •  Qt, licensing
When launching a new project using Qt, you have to decide whether to buy a commercial license or use the free, open source version. It’s an easy decision. Free is better, right? Well, not always. Here's why. In a typical year, ICS works on more than 75 new and unique embedded devices based on Qt. Everything from a flying autonomous taxi service to lifesaving medical devices to an industrial control system for a shrink-wrap pallet machine. But despite the differences in these devices, every ICS proposal for our software development services includes the statement: ICS recommends that…