The goal When building C++ code with CMake, it is very common to want to set some pre-processor defines in the CMake code. For instance, we might want to set the project’s version number in a single place, in CMake code like this: This sets the CMake variable PROJECT_VERSION to 1.5, which we can then […]
Author Archives: David Faure
Six Tips for Maximizing Desktop Screen Potential
Desktop software has many differences from mobile and embedded applications but one of the biggest and most obvious is the screen. How can you take advantage of all that real estate for your application? Six considerations for managing the screen in your desktop application Choosing the right GUI framework Use a flexible GUI framework that […]
Mastering Cross-platform Desktop Apps
Creating applications for cross-platform compatibility is a modern best practice. It increases deployment flexibility and allows applications to reach a wider audience. However, doing it properly can involve some trial and error. At KDAB, we’ve built many multiplatform desktop applications. Here, we’ve compiled a few insights from that process to help you build better software. […]
C/C++ Profiling Tools
This blog will give you a brief overview of profiling C and C++ applications. Additionally, it will lay before you all of the tools available, with the purpose of aiding you in choosing the right tools at the right times.
C/C++ Debugging Tools An Overview of Debugging Tools for C and C++ Applications
In this blog on debugging and profiling, I would like to give you an overview of the debugging tools that exist for C and C++ applications. Automated Testing The first thing you need to do is make sure your code is properly tested. This, in itself, is not debugging, but it enables you to make […]
Say No to Qt Style Sheets Making the Right Choice Between QStyle and Qt Style Sheets, Upfront
You have two choices when it comes to giving a custom style to your Qt widgets. Qt Style Sheets are very convenient for getting started — just a few CSS-like rules, and they work. It is our experience, however, that Qt Style Sheets create too much trouble and a QStyle subclass (*) gives a better […]
Fun and Scary Code from Qt and KDE
These are some really cool or obfuscated code snippets for your amusement. We didn’t want to rate them, so the order doesn’t mean anything at all 🙂 Just to make sure that there’s no misunderstanding: This code really is/was in the Qt or KDE repositories. From Kivio, main.cpp From Qt 2.2.1 (src/canvas/qcanvas.cpp) Writing code that […]
Auto-Accepting in QSortFilterProxyModel Since Qt 6.0, QSortFilterProxyModel Can Auto-accept Child Rows of Rows Matching the Filter.
In Qt 5.10, we added support for recursive filtering in QSortFilterProxyModel, which means keeping all parents of items matching the filter. One of the comments in the blog post about that feature was “Sometimes, you do not only want to show parents for a match (so the match is visible), you may (also) want to […]
The cmake-project Script Generating a CMake Project For a Single Executable in C++
If you ever need to create a project around a single C++ file (or just a few C++ files) in CMake, as you might for quick test cases, you might find it tedious to write a CMakeLists.txt file by hand every time. To make this easier, I’ve written a script called cmake-project that you can […]
Hotspot: How const Can Improve Performance
Some time ago, I noticed that a unit test was quite slow, using 100% CPU for a number of seconds at one point in the test. I used perf and KDAB’s Hotspot to record and examine where the CPU cycles were spent in that unit test, and I quickly noticed that a lot of time […]