Hi,
I just started to use Qt Open Source edition last week.
In my test-project I'm using a QSqlTableModel with a QTableView to display data.
One column has an integer value of 0 or 1 which I want to be displayed as a checkbox in the QTableView. The user should also be able to click on it to check/uncheck.
My database engine is SQLite, and it does not have a boolean column type, so no automatic definition can be made.
I've been browsing the forum and following some examples I've sub-classed the QItemDelegate and used setItemDelegateForColumn(), but this only displays a checkbox after double-clicking for editing.
I want a checkbox to always be displayed in the view.
I haven't re-implemented the paint event yet, but it seems a little awkward to have to re-implement so many functions when there is a Qt::ItemIsUserCheckable flag for the model.
Have I started out all wrong?
Is there a way that I could set the Qt::ItemIsUserCheckable flag in the table model for my column to handle this more or less automatically?
Best Regards,
Ingemar
Bookmarks