Sign up for the KDAB Newsletter
Stay on top of the latest news, publications, events and more.
Go to Sign-up
Find what you need - explore our website and developer resources
10 October 2025
In the previous episode, we learned how to add drag and drop to a widget. We could now take that knowledge and add drag and drop to list views, tables and tree views, but that would be quite a bit of work.
Fortunately, QAbstractItemView (which is the super class for those three) does already have support for it.
All we need to do is to add information in our model about what is being dragged out, or how to handle data being dropped on it.
Chapters:
00:00 Welcome
00:27 What do we get out of the box?
04:58 The dropside example
06:04 QStandardItemModel's default drag and drop implementation
07:45 Advertise: Modernizing your C++ code
08:14 Implementing drag from my own models
12:20 The drop side of my own models
14:30 Just a note
16:38 The example
Links:
The example code showcased in this video is available here.