David Faure
19 results
This post explores implementing drag-and-drop onto existing items in Qt, such as moving emails between folders. It covers both Model/View and Item Widget approaches, detailing key setup steps and improvements made to Qt along the way.
In this follow-up to our drag-and-drop guide, we explore how to move items between views in Qt’s model/view framework. Learn how to set up both drag and drop sides, handle MIME data, and implement key model methods. Whether you're working with model/view separation or with item widgets, this post provides practical examples to help you customize UI interactions effectively.
This blog post is the first in a series on implementing drag-and-drop in the Qt model/view framework. It covers how to reorder items within a single view, whether you're using QListView, QTableView, or QTreeView with a custom model, or QListWidget, QTableWidget, or QTreeWidget with items. The post includes code examples, checklists, and insights into improvements made in Qt 6.8 for smoother drag-and-drop functionality.
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 […]
While desktop development shares a lot of best practices with other types of software, a few things make it stand apart. Development of an application that sits on a user's desktop, no matter what that consists of, requires a flexible design. Desktop applications are bigger than programs for embedded and IoT and they demand an architecture more complex than server or cloud apps with their tightly controlled environments. Here are some of our best practices for building these complex desktop applications.
Six Tips for Maximizing Desktop Screen Potential
29 August 2024
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
15 August 2024
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. […]
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. The Steps for Profiling Before we look at the actual tools, let's go over the […]
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 […]
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 […]
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.
6 October 2021
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 […]
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 […]
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 […]
When using Qt's model/view framework, filtering has always been very easy with QSortFilterProxyModel. To filter a list using text typed by the user in a line-edit, you have certainly been applying the standard recipe: instantiate the proxy; insert it between view and source model; connect the lineedit's textChanged signal to the proxy's setFilterFixedString slot; done! […]
A retrospective on the KDE community from 20 years ago and how things were done back then, with an emphasis on community spirit and fun facts. Over time, the KDE community has seen many people join and leave, as with any open source community, which means that very few people in the current community still […]
Additional Qt libraries outside Qt Project
13 March 2015
Abstract: This presentation will start by explaining the concept of inqlude.org and showing some of the libraries available there, pointing in particular to those that will be useful in the rest of the presentation. The multiple ways to use inqlude.org will be discussed: browsing the website and downloading sources, using the command-line tool to install […]
Last week I visited a new customer who is making medical and industrial devices which have one thing in common: image and video capturing, and letting the user save these files onto a USB key. These devices run embedded Linux and the application is done in Qt (and gstreamer for the video capture). The new […]
How to use helgrind to debug multithreaded Qt applications
Finding thread race conditions in Qt applications
(NOTE: this blog post has been edited many times since its original publication) You've heard of valgrind before, its default tool (memcheck) is such a life saver, being able to detect memory-related bugs in your code (leaks, double deletions, use of deleted memory, use of uninitialized memory, etc.). Well, it turns out that valgrind also […]