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
2 March 2022
When writing models using Qt's ModelView framework, are you always checking the indexes you are given, say, in rowCount?
Well, obviously Qt itself isn't so broken that it gives you indexes out of range or from the wrong models, is it?
The good news is, no it isn't.
The bad news is, you (or your co-workers) might have written a broken proxy or interacted directly with the model in incorrect ways.
This video will walk you through a bunch of macros to help you test your indexes before using them.
* Episode on special roles for communicating through proxy models: https://www.youtube.com/watch?v=q6eOEz_UfTI&list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI&index=10
* For more details see this blog post on checkIndex: https://www.kdab.com/new-in-qt-5-11-improvements-to-the-model-view-apis-part-1/
The example code showcased in this video is available here: https://github.com/KDAB/kdabtv/tree/master/Qt-Widgets-and-more/CheckIndex
All Qt Widgets and more videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI