Giuseppe D’Angelo
97 results
On QVarLengthArray and Uninitialized Storage in C++
10 January 2023
If you're following our Youtube channel you might have heard me talking about QVarLengthArray. If you're not... you should follow us! But let me give you a quick recap. QVarLengthArray is a Qt container that acts like a vector; its elements are stored contiguously in memory and it has a dynamic size. At any time […]
QVarLengthArray is a container class with interesting semantics, not found in any container from the Standard Library. Like an array, it stores elements contiguously in memory. Like a vector, it has dynamic size. But unlike a vector, it does not necessarily store them in heap-allocated memory.
When working with Qt, the question always arises: "Should I use Qt containers or Standard Library containers?" This isn't a simple binary choice involving just features - ease of use, convenience, familiarity, and interoperability all matter. This video illustrates pros and cons of both options to help you make an informed decision.
In this episode we'll talk about associative containers: containers that map arbitrary keys to values. What are the ones that are provided by Qt? Are there differences between their Qt 5 versions and their Qt 6 versions? Which one should one pick for a given use case? No spoilers – watch until the end (Lächeln)
In this video we discuss the two most used Qt containers: QList and QVector. How do they work? Are they similar to the std counterparts? What has changed in Qt 6 regarding them?
All Qt containers have a specific feature: they are "implicitly shared", also known as "copy on write". What does that mean exactly? What are the advantages for developers who use these containers? Are there any downsides?
Containers are data structures that hold arbitrary amounts of data (lists, maps, etc.). Qt ships with its own container family even though C++ and Python have their own. This video series answers: What are Qt containers' features? Should you use them? How do they differ from C++ Standard Library containers? What changed between Qt 5 and Qt 6?
This talk presents Unicode string handling foundations in Qt. We'll explain the Unicode standard, why it's necessary for user interfaces, and discuss Qt's low-level classes (QChar, QString) and how they map to Unicode concepts. We'll cover Qt's higher-level facilities including collation, grapheme cluster iteration, and locale-aware formatting—all essential for proper user interfaces.
You can speed up Qt applications almost for free by adding a single define to enable QStringBuilder. The catch: your code may fail to compile or crash in some places, but clazy will warn about potential crashes and the compiler will catch errors.
Qt comes with lots of classes relating to strings these days, including QString, QStringView, QStringLiteral etc. It comes with so many that I lost track, so maybe it is time to call my good friend Peppe. In this episode we will discuss what you need to know to get it right at least 95% of the cases, without knowing it all.
KDToolBox is KDAB’s collection of miscellaneous useful C++ classes and stuff, available on GitHub under a very permissive open source license (MIT). There’s a lot of goodies in there: from a single-shot QObject::connect(), to a table model to list model flattener proxy, to a UI watchdog class.
This episode explores C++'s explicit keyword: why there's no implicit keyword, why it's needed for QObjects, and available tooling. Topics include implicit conversions in string classes, when conversions go wrong, explicit to the rescue, named constructors, QObject-specific issues, Q_IMPLICIT, explicit(false), clang-tidy support, and rules for when implicit conversions are acceptable.
C++23 is feature complete and on track to be released next year. While many people are complaining that it's, after all, a "minor" release (as the pandemic made the Committee work very difficult), C++23 still has a few very significant changes. In this blog post, I want to talk about what I think is my […]
Another day, another small addition to KDToolBox, KDAB's collection of miscellaneous useful C++ classes and stuff. In this post, we're going to talk about KDFunctionalSortFilterProxyModel, which is a convenience subclass of QSortFilterProxyModel. What's a proxy model to begin with, and what's QSortFilterProxyModel? Well, that explanation requires a bigger space than what I have in this […]
(Apologies for the clickbait in the post title! But I'd really like people who are searching for solutions to read this.) Between Qt 5.14 and Qt 5.15, my colleague, Marc Mutz, and I submitted a series of patches to Qt that added "range constructors" to the Qt containers. This brought Qt containers one step closer […]
In the previous blog post of this series, we discussed KDToolBox::QtHasher, a helper class that allows us to use unordered associative containers datatypes which have a qHash() overload but not a std::hash specialization. The majority of Qt value classes indeed are lacking such a specialization, even if they do provide a qHash() overload. For our […]
This talk argues that C++ is excellent for embedded development, going beyond being a "superset of C" with stricter typing, automatic resource management, generic programming, and performance improvements over equivalent C code. It aims to demystify C++ myths that have become self-fulfilling prophecies, showcasing code demonstrating how C++ helps C developers create more robust, efficient software.
Sometimes it's useful to establish a connection between a signal and a slot that should be activated only once. This is not how signal/slot connections normally behave. Remember that, when a connection is established, it will stay active until: the connection is explicitly disconnected; or the sender object is destroyed; or the receiver object is […]
Another day, another blog post about KDToolBox, KDAB's collection of miscellaneous useful C++ classes and stuff. Today, we'll talk about ways to throttle your signal/slots connections -- in other words, how to activate a slot less often than the emission rate of the signal it's connected to. The usual reason why you may want something […]
In the previous blog post about qHash, we explained: how to declare an overload of qHash for your own datatypes, how to hash Qt datatypes for which Qt does not provide a qHash overload, and why you can't use a type from the Standard Library (or just another library) as a key in QHash (newsflash: […]