On 23.11.07 09:04:56, Chris Dunscombe wrote: > Hi, > > I'm trying to have a checkable column plus label with other columns in a > table. I can't use > QTableWidget as one of the other columns is a ComboBox. After much trying, > googling and reading of > Mark's excellent new book I just can't get it to work. I'm clearly doing > something wrong > > Main problem is that the label doesn't display unless it's being clicked. > Also I can't check the > checkbox unless I've previously double-clicked in the area where the label is.
Why do you try to use a QCheckBox in the first place? Just return the Qt::IsUserCheckable flag in flags() and react to the Qt::CheckStateRole in data() for the apropriate column. Then the view itself will add a checkbox to the column and display the text from data(). Works like a charm. Anyway, some comments... > class myModel(QStandardItemModel): This is wrong, you're misuing the standard item model. Please read its API docs, its usually not needed to subclass it, you only need to create QStandardItem's for the various cells in your model and set them checkable if they should be checkable. If you want to write your own model, because you have some custom/legacy data format use QAbstractTableModel as base (when its tabular data) or QAbstractItemModel (if its tree-like data). Andreas -- Long life is in store for you. _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt