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
21 April 2025
It is finally time to learn how to implement our own models. We will start with lists and tables in this episode, and later move on to tree models.
Chapters:
00:00 Welcome
00:32 List Models
01:51 rowCount() for lists
03:03 data() for lists
03:35 Remember to look at role - hint: USA!
04:54 Separation of business logic and representation
05:51 Advertise: Rust training
06:06 Editable models
06:55 flags()
07:04 setData()
08:17 emit dataChanged
11:00 Structural changes
17:19 Tables
19:07 What's next?
Links:
* Episode on QVariant: https://youtu.be/c99eN8qVmHg?list=PL6CJYn40gN6iFcTyItvnE5nOmJR8qk_7o
* QWAM Episode on implementing a complete proxy model:
* Part 1: https://youtu.be/fPy0nuGWTZk?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI
* Part 2: https://youtu.be/7wObo3LVcWA?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI
* KDAB Rust Training Portfolio: https://training.kdab.com/portfolio/rust/
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