Friday, September 13, 2019 - 16:52 ">  •  By Chris Cortopassi  •  QML, Qt
Continuing our QML Controls from Scratch series, this time we will implement a Spinner, also known as a busy indicator. Spinner indicates the progress of a long-running operation when the progress percentage is unknown. (For known percentages, we'd use a ProgressBar.) Spinner uses a Timer to animate rotation. Normally, a designer would provide us with a .png asset to rotate an Image, but for this example we rotate an array of circles, implemented with Rectangle. Spinner has no public properties. Spinner.qml import QtQuick 2.0 Item { id: root // public…
Thursday, September 12, 2019 - 12:06 ">  •  By Jeff Tranter  •  embedded systems
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…
Wednesday, September 4, 2019 - 15:26 ">  •  By Jeff Tranter  •  Embedded, Qt
This blog is part of a continuing series on GPIO programming. If you missed earlier installments, find them here. In this post we'll look at a representative embedded board, one that we use for our embedded training classes and that we have used on a number of customer projects. Toradex [1] is a vendor of embedded computing hardware, and offers a number of computer modules. A typical offering is the Colibri iMX6 [2] series of SoM (System on a Module). They are offered in a SODIMM footprint, the same used by Small Outline Dual In-line Memory Modules. They offer two versions with differing…
Friday, July 12, 2019 - 13:03 ">  •  By Chris Rizzitello  •  Qt
Today’s market is global and many companies have begun to fully embrace Internationalization in their applications. If you are not familiar, Internationalization is the process of designing a software application in a way that it can be easily adapted for use in languages and locales other than the one it was created for. Here's the Wiki definition: Internationalization is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes.  Here’s how it works in its most basic form. An application provides a…
Monday, July 1, 2019 - 13:15 ">  •  By Steve Holcomb  •  Qt
Regular Expressions are tools for finding patterns in data. They are an extremely powerful tools, but are also full of arcane rules and cryptic combinations of symbols. Good user interface (UI) design can use Regular Expressions, but shouldn’t require the end-user to enter the Regular Expressions themselves. A well-designed interface can allow the end-user to quickly and easily use Regular Expressions when searching, sorting and filtering data. Here’s an example, a short application that demonstrates one use for Regular Expressions. (It is a Qt project, which can be compiled and…
Monday, June 3, 2019 - 14:06 ">  •  By Jeff Tranter  •  embedded systems, Qt
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…
Wednesday, May 8, 2019 - 08:30 ">  •  By Christopher Probst, ICS Development Team  •  Qt, QML, Qt Quick
In part one of this blog series we explained the concept of model-view design and explained the need for a more advanced process for handling dynamic data. In part two, we illustrate the power of Qt Quick’s model-view-delegate framework with an example application that downloads mp3 files from the web. We point out best practices and common pitfalls while writing a C++ model in Qt Quick. Our example is hosted in this GitLab repository, and it requires Qt 5.12 or later and a C++14 compiler. We recommend cloning the repository, opening the project in Qt Creator, and following along…
Wednesday, May 1, 2019 - 11:55 ">  •  By Christopher Probst, ICS Development Team  •  Qt, QML, Qt Quick
The speed on your car’s dashboard, the temperature on your cabin’s thermostat, the heart rate on your wearable device. These values originate from an external source, populate a model, and then make their digital way to a display. The task of the GUI developer is to write code that fetches this data from an external source, organizes it, and then presents it beautifully. Writing such a model, and providing it to a view, relies on the model-view design pattern. With Qt Quick, one way to achieve this is to wrap a third-party library with a QObject and map every value on the display to a Qt…
Monday, April 1, 2019 - 12:45 ">  •  By Christopher Probst  •  Qt
As the first interaction a user will have with your desktop application, critical, necessary and hopefully welcoming, an installer is often overlooked and in need of some love. So to give it its necessary due, here's an overview of a tool that may help: the Qt Installer Framework. Installing the Installer The pre-built version of the framework comes with Qt; you just need to check “Qt Installer Framework 3.0” on the components page of Qt’s installation program. And yes, if you’re wondering, Qt’s own installer was implemented using this framework. It is also available here…
Friday, March 8, 2019 - 13:24 ">  •  By Vy Duong  •  Qt
Yocto can be intimidating for newcomers — even challenging for seasoned users. But, the benefits of gaining ease with Yacto far outweigh the pain endured. Here are four tips and tricks that can come in handy when working with Yocto. (If you’re brand new to Yacto, check out Yocto Quick Start for a solid introduction.) 1 Finding What’s Available BitBake projects are generally organized in folders that contain metadata, configuration files, and recipes. These folders are generally referred to as a layer or a meta-layer. It is a common practice to prepend these project folder names…
Wednesday, February 20, 2019 - 10:57 ">  •  By Stephanie Van Ness  •  Qt, voice assistant, automotive IVI
Voice has always been recognized as an ideal way for a driver to interact with an auto because it reduces driver distraction. However, the lack of familiarity with most current automotive voice systems, along with their constrained set of commands, has resulted in low use and adoption rates. Integrated Computer Solutions (ICS) and The Qt Company are working together to change that. Their goal is to foster new breakthroughs in the use of voice in automotive, and support creation of a safer driving environment. The companies are working together to integrate Amazon Alexa into Qt and take…
Thursday, February 7, 2019 - 09:59 ">  •  By David Chamberlain  •  Qt
Qt Creator wizards are powerful code-generation tools that expedite time to development. In this article, I'll discuss the types of Qt Creator wizards that are available to developers at present, with a focus on templated wizards. I'll also provide helpful tips for preparing to write them. Qt Creator Wizards Here's an example of a screen in a Qt Creator wizard. This particular wizard, packaged with Qt, is a JSON-based templated Qt Creator wizard.  Within Qt Creator, whenever you endeavor to create a new file or project, you are directed to the New File or Project dialog.…
Thursday, February 7, 2019 - 09:05 ">  •  By Leon Lin  •  Qt
Concise Binary Object Representation (CBOR) format is a compact form of binary encoding for data serialization. It is similar to JSON in that most data is represented by name-value pairs, and its design emphasizes compactness for better processing and transmission speeds. The format was created by the Internet Engineering Task Force’s (IETF) Constrained RESTful Environments (CoRE) working group, and is intended to be used with the CoAP protocol to support the Internet of Things. Qt has added support for handling CBOR data in 5.12. This includes classes to encapsulate CBOR data, as well…
Wednesday, February 6, 2019 - 09:37 ">  •  By Leon Lin  •  Qt
When writing an application with Qt, do you need a way to represent dates? Do you want to be able to display dates in a variety of ways, say in a report? Or do you need to do calculations with dates — what date is three years, five months, and four days from now? All this and more can be handled by Qt’s QDate class. QDate represents a date in the proleptic Gregorian calendar and has a variety of useful functions for handling all your date-related needs. An Example To illustrate what you can do with QDate, I’ve written a simple program that demonstrates much of the class’s functionality.…
Tuesday, December 18, 2018 - 14:55 ">  •  By Jeff Tranter  •  C++, Qt
Are you up to date with the latest C++14 and C++17 language features? Are you writing "modern C++"? Do you follow current best practices for C++? Are you avoiding deprecated language features and outdated programming practices? C++ has evolved significantly in the last few years with the introduction of the C++11, C++14 and C++17 language standards. In my experience, a lot of Qt developers have not kept up with these new language features. That's a shame because "modern C++" (the term commonly used for C++11 and later) often leads to code that's easier to understand, better…
Wednesday, December 12, 2018 - 14:33 ">  •  By Jeff Tranter  •  Qt
As 2018 draws to a close, it's time to take the pulse of the Qt ecosystem and review some of the significant events and milestones of this year. Qt Releases The Qt project continued with its practice of releasing two major versions per year, as well as a number of maintenance releases. First released in 2017, the Qt 5.9 series is an LTS (Long Term Support) version, which will be supported for three years. This year saw maintenance releases of Qt 5.9.4 (Jan), Qt 5.9.5 (Apr), Qt 5.9.6 (Jun), and Qt 5.9.7 (Oct). Shortly after the release of Qt 5.10.0 in late 2017, this year started off…
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…