Re: [PyQt] Help with QTableView

2008-01-29 Thread Catriona Johnson
Thanks for that and sorry for taking a while to get this but I tried what you said and I still can't edit the checkboxes. I can howerver edit the space to the right of the checkboxes which I don't want to do. Updated setData method below: def setData(self, index, value, role): if i

Re: [PyQt] Help with QTableView

2008-01-29 Thread Brian Kelley
For both the data and setdata method, checkboxes are only retrieved or set for the CheckStateRole. Simply add an: if role == Qt.CheckStateRole: ... to your setData method and you should be off to the races. On Jan 29, 2008, at 5:22 PM, Catriona Johnson wrote: Thanks Brian I tried t

Re: [PyQt] Help with QTableView

2008-01-29 Thread Catriona Johnson
Thanks Brian I tried that and the checkboxes are showing the right value but I am unable to edit the checkbox only the datarole. What am I doing wrong?? Code sample below. from PyQt4.QtGui import * from PyQt4.QtSql import * from PyQt4.QtCore import * import sys class MyModel(QSqlRelationalTableM

Re: [PyQt] Help with QTableView

2008-01-25 Thread Brian Kelley
in the model's data method: def data(index, role): ... if role == QtCore.Qt.CheckStateRole: return QtCore.Qt.Checked # or UnChecked Note you can have a checkbox along with the datarole as well. On Jan 18, 2008, at 12:10 AM, Catriona Johnson wrote: Hello How do I implement a checkbox

[PyQt] Help with QTableView

2008-01-17 Thread Catriona Johnson
Hello How do I implement a checkbox in a QTableView column that retreives/stores values in a database? Also, I have one model with columns say abc and I have two QTableViews of this model that show the columns in different orders - bca and cab. How do I change the column order in the QTableView?