Jesper K. Pedersen
282 results
In this episode, for an application with a lot of QTableViews and QTreeViews (many with context menus), Jesper presents a solution where he does not need to add a new subclass each time he wants to set up a custom context menu. Further, a problem with the syntax, where lots of std::unique_ptrs got in the way, is discussed.
QTimers
18 May 2023
Exception Handling in Qt
10 May 2023
Structural Bindings with Qt Containers
23 March 2023
Working with Git Sub-Modules
25 January 2023
Are you already convinced and just want to download the library? We're glad you liked it: https://github.com/KDAB/KDAlgorithms I'm sure many people have told you time and time again, "Don't use raw for loops; use algorithms." Still, each time you tried, you found your code harder to read. In case you're wondering, the above simply prints […]
Adding KDAlgorithms as a Git Sub-Module
11 January 2023
This episode builds on the previous three to understand complex template code - a modified transform function that takes containers instead of iterators and returns transformed containers. The key feature is smart container reuse: when result and input containers are the same type and input is an r-value, it reuses the input container rather than creating new ones.
Understanding C++ Type Traits
28 December 2022
Template code commonly uses type traits to test type properties: is it an l-value, is it const, does it have a method, etc. This episode investigates how type traits are implemented by creating our own versions of is_same_v, is_const_v, and integral_constant, building foundational knowledge for understanding complex template code like type comparisons and r-value detection.
Template Specialization in C++
20 December 2022
This video shows how to "overload" templates with two real-world examples: a sort function with general implementation plus char specialization, and a vector implementation with boolean specialization for space efficiency. Finally, we'll see how to make C++ reveal what type a template parameter represents.
A super fast intro to C++ templates
14 December 2022
In this episode we will start slowly understanding what a template is, but within 15 minutes we will have seen the assembly code generated, have discussed template type parameters and non-type parameters, and finally have discussed template template parameters (no that is not a mistake that it says template twice!)
Do Use C++ Algorithms!
7 December 2022
You have likely heard it before - "no raw for loops, use algorithms instead". In this episode, Jesper will give a few examples of code that became much cleaner when rewritten from raw loops to algorithms. Further, he will introduce an algorithm library he has written to make it much less painful to write code using algorithms.
Every now and then, when I submit some code for a code review, people tell me that I forgot qAsConst. Now I have one more enemy, namely: Clazy! It has also started saying this, and I guess it's about time for me to figure out what is going on. When do I need qAsConst and […]
Checking for Regression via Screenshots
18 October 2022
When making large code changes, you want to validate there are no side effects. While unit testing is ideal and Squish tests are good, both may be unrealistic. A "better than nothing" solution is running original and modified applications side-by-side and comparing them. This small application easily takes screenshots of each and compares them.
KDAB and Qt World Summit 2022
12 October 2022
KDAB will be Gold sponsors at this year’s free online edition of Qt World Summit on November 9th, 2022. Our very own Jesper Pedersen will present his talk “Highlights from Qt Widgets and More”. Don’t miss out! Join developers, designers, managers, and executives to get inspired by the latest developments with Qt. Register now and […]
Reading the Qt Source Code
6 October 2022
For a while, I thought Qt Creator's rename symbols and grep had a bug when they didn't find all occurrences. After filing a bug report, I learned it's actually a feature - you need to add all header files to CMakeLists.txt for it to work properly. This video shows how to fix your CMakeLists.txt files.
Improving My clang-tidy Checks
21 September 2022


