Decorating your item models with a checkbox
In response to a "question":http://developer.qt.nokia.com/forums/viewthread/5051/ here on the forum, I started thinking about creating a generalized component to add check boxes to item models. The result is a subclass of QSortFilterProxyModel that decorates its source model with a checkbox in column 0 of each row. The proxy also handles tree-type models.
!http://dl.dropbox.com/u/16442531/CheckableProxyModelDemo.png(Demo application showing the capabilities of CheckableProxyModel)!
The class features API to check and uncheck items in from your model, and notifies you using a signal when the list of (un) selected items has changed.
The source code is available from "Gitorious":https://gitorious.org/checkableproxymodel, and licenced under GPL-3.
I have also added this as a "snippet on the wiki":https://developer.qt.nokia.com/wiki/QSortFilterProxyModel_subclass_to_add_a_checkbox.