KDAB_Tree_Header_Mobile KDAB_Tree_Header_Web

Trusted Software Excellence since 1999

Jesper K. Pedersen

269 results

This video shows how you can use your own custom types to communicate between a model and a delegate editing these custom types. My example is a Money class which contains a currency and an amount. The delegate will see Money instances, rather than parse them from their string representation.

In this module we'll use the knowledge that we gained in module 7, QObject, signals, slots, properties, variants, in order to make C++ and QML talk to each other. In this first video, we are going to show how we can export objects of value classes (numbers, strings, etc.) from C++ to QML.

This video shows how to export QObject subclasses to QML. While similar to the previous video, QObjects aren't value classes and add features like properties, signals, and slots via the meta-object system. We get all these features when exporting QObjects to QML!

When QObjects in C++ are exposed to QML, who manages their lifetime? Can QML's garbage collector reclaim them if they're still needed in C++? What happens if C++ doesn't delete them, expecting QML to handle it? This video explores object ownership between C++ and QML.

This video discusses how to create GUI elements in C++, and make them available to QML. It's just as simple as creating non-GUI elements, with a very small twist.

Previous videos showed exporting individual C++ objects to QML. This video covers something related but different: exposing C++ classes to QML so QML can create instances. We'll start with non-GUI classes; the next video will cover GUI classes.

Any non-trivial Qt application uses the model/view/controller framework, a design pattern separating data management from UI. This video focuses on the "model" aspect that interacts directly with data. Models are central to Qt across all UI stacks (Widgets, Quick, remote objects). While custom views are rare, developing custom models is very typical.

It can visualize the stack of models for you, but there is one thing you better remember in your code --watch this video to find out what it is! :)

Sometimes views or delegates need to ask questions of the source model at the bottom of a proxy model stack. While the previous video showed using custom roles for cell-specific data, this video demonstrates a better approach for non-cell-related data: traversing proxy models yourself to reach the actual source model.

Got a stack of proxy models where there is a subtle bug somewhere in there? No worries --GammaRay to the rescue! It can visualize the stack of models for you, but there is one thing you better remember in your code --watch this video to find out what it is!

Remember discussing QML properties 25 videos ago? Qt allows you to define properties in C++ for QObject subclasses by describing their type, name, and read/write methods. This final module video covers the Qt Property System, its usage, and how it fits the bigger picture. Bonus: how QVariant relates to the property system.

QVariant is a cornerstone Qt class used in the property system, model/view, and C++/QML data exchange. It's a type-erased container similar to std::any, storing objects of almost any type while remembering the stored type. This video demonstrates how QVariant works in practice.

"unresolved external symbol 'public: virtual struct QMetaObject ...'" - a mysterious linker error that sometimes occurs when working with QObjects and signals/slots. This video explains what causes it, how to solve it with just one click, and what happens behind the scenes where the build system meets signals and slots.

QObject implements a huge number of features: properties, events, signals and slots, automatic memory management and much more. In this module we are going to explore how they work and how they map to all the QML knowledge that we have built so far.

"When the user clicks this button, run this code" is one of programming's oldest problems. Qt's solution is the signals and slots mechanism: buttons emit signals when clicked, slots contain the code to run, and connections link them together. This video explains creating such connections in C++.

This video continues the signals and slots discussion, exploring three connection methods: pointer to member functions (PMFs), string-based SIGNAL/SLOT macros, and function objects (including lambdas). We'll examine the PMF syntax introduced in Qt 5 and compare it against the string-based approach, discussing the pros and cons of each.

Did you know that you can connect a QObject signal to a lambda function, or to any free function or function object, for what it's worth? It's extremely convenient, but it comes with its own set of "gotchas" that we must understand. In this video we'll explain the syntax and reason behind the good use cases of connecting to a lambda function instead of connecting to a "regular" slot.

In the previous videos of this module we have learned how signals and slots work. We have also learned how to connect an existing signal to an existing slot (in all its variations). In this episode, we will build up on that knowledge and discuss how to declare and implement custom signals and slots – and why we would want to do that!

Sometimes views need more data than what's displayed in a cell. Examples include context menus for employee cells (where only the name shows) or annotation symbols for annotated data. While views could call the model directly, this breaks with proxy models in between.

This video explains how to install and use the SpellChecker plugin for Qt Creator, a third-party contribution. GUI applications contain many user-visible strings, so shipping software with spelling mistakes would be embarrassing. While word processors have long included spell checking, programming editors traditionally lacked this feature - until now!

JesperKjaerPedersen

Jesper K. Pedersen

HR Director / COO