Decorating your item models with a checkbox
-
wrote on 28 Apr 2011, 18:08 last edited by
Introducing CheckableProxyModel:
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.
-
wrote on 29 Apr 2011, 09:57 last edited by
I have also added this as a "snippet on the wiki":https://developer.qt.nokia.com/wiki/QSortFilterProxyModel_subclass_to_add_a_checkbox.
1/2