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
22 April 2025
In this episode I will live code a model based on QAbstractTableModel.
Chapters:
00:00 Welcome
00:54 The end result
01:50 The starting point
03:29 Creating a QTableView in main.cpp
04:57 Setting up the DepecheModel
07:55 The default implementation by Qt Creator
09:45 Implementing headerData
12:20 Implementing rowCount
13:21 Advertise - Braumeister
13:49 Fixing why nothing showed up
16:08 Implementing columnCount and header for columns
20:01 A bit of cleaning up
20:47 Implementing the data method
25:00 Implementing the check boxes
29:50 Alignment
33:40 Turning the column enum into an enum class
36:47 EnumConverrters.h
42:47 What's next?
Links:
* QWAM episode on flags - https://youtu.be/EGhHlPDeyvg?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI
* QWAM episode on Github Copilot - https://youtu.be/kQzpvHPeBQo?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI
* QWAM episode on favorite shortcuts in Qt Creator: https://youtu.be/7Zn6r9HYy6Y?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI
* Video on Braumeister: https://youtu.be/OFohLXdtCzM?list=PL6CJYn40gN6hWTi9AEI1zSfbmC4Skmokb
* QWAM episode on Clang Format - https://youtu.be/Cz36YveDI2E?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI
The example code showcased in this video is available here:
https://github.com/KDABLabs/kdabtv/tree/master/Programming-With-Qt-Widgets/modelview
All 'Introduction to Qt Widgets - Module 1' videos: https://www.youtube.com/playlist?list=PL6CJYn40gN6hgf7zCKF2Rv9Y0WoN8RVGf
All 'Introduction to Qt Widgets - Module 2' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6j_c41CFMprvg9EiWz0WdSy
All 'Introduction to Qt Widgets - Module 3' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6hWZO_viEf1rfjgk4E6SCKd
All 'Introduction to Qt Widgets - Module 4' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6iXUNQMb2GkEjV_oK6Xid9-
All 'Introduction to Qt Widgets - Module 5' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6h1tsLAETdrrFlsVMeYpiHI
All 'Introduction to Qt Widgets - Module 6' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jIsRYriqN70V83t_mdDZHT
All 'Introduction to Qt Widgets - Module 7' videos: https://www.youtube.com/playlist?list=PL6CJYn40gN6hHyqD9ZxUqpd14LoHvadN7
All 'Introduction to Qt Widgets - Module 8' videos: https://www.youtube.com/playlist?list=PL6CJYn40gN6iCb8g5NSfVqX0JRFzFnxak