Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, February 2008
QTableView checkboxes


Message 1 in thread

Hello everyone,

I am writing an application which is using QTableView to display a 
QSqlTableModel; however, when it is displayed, all of the cells have 
checkboxes in them.  I haved tried multiple ways to remove the checkboxes but 
have been unsuccessful. Does anyone have a suggestion to remove them?

I have tried the following:
setSelectionMode(QAbstractItemView::NoSelection)
reimplemented flags() in model to return only Qt::ItemIsEnabled 

Thanks,
Chris Holzhausen  

--
 [ signature omitted ] 

Message 2 in thread

Chris Holzhausen wrote:
> I am writing an application which is using QTableView to 
> display a QSqlTableModel; however, when it is displayed, all 
> of the cells have checkboxes in them.  I haved tried multiple 
> ways to remove the checkboxes but have been unsuccessful. 
> Does anyone have a suggestion to remove them?

We had this problem as well.  In addition to not indicating
Qt::ItemIsUserCheckabe or Qt::ItemIsTristate from the flags function,
you need to make sure the data function returns a null variant
(QVariant()) for the Qt::CheckStateRole.  You can implement this by
overriding the data function or calling setData to set a null variant on
the appropriate indices.

Rob

--
 [ signature omitted ]