[Qt-interest] Editing data in a somewhat peculiar model

Christopher Rasch-Olsen Raa christopher at technophile.info
Tue Feb 3 18:57:48 CET 2009


Hi folks,

I'm interested in your opinion on what would be the best way to grab some data from a database table (using QSqlTableModel) then presenting the data to the user in a QTableView with the following criteria:
 - Only two columns should be editable
 - One of the columns (COL1) should hold a value that the user can edit (on a condition mentioned below)
 - The other of the two columns (COL2) (storing an unsigned integer) should contain a QCheckBox. Value 1 -> Checked, 0 -> Unchecked.
 - When the checkbox is unchecked the value in COL1 for that row should be editable
 - When the checkbox is checked the value in COL1 for that row should not be editable
 - The checkbox in COL2 should _always_ be visible

Any thoughts on what would be the cleanest approach to this? I'm thinking that I'd have to use a QItemDelegate for parts of it but I'm still a little unclear about the details on eg. how to disable editing in some rows only, etc.

Hope to get some feedback.


Best,
Christopher




More information about the Qt-interest-old mailing list