[PyQt] Model/View programming

Benjamin Sonnemann mail at sonnemann-it.de
Thu May 6 16:32:30 BST 2010


perhaps setColumnHidden is what you seek?

http://doc.trolltech.com/4.6/qtableview.html#setColumnHidden

Am 06.05.2010, 17:15 Uhr, schrieb Philippe Crave  
<philippe.crave at gmail.com>:

> looks like that I have to do a QAbstractTableModel for each QTableView,  
> no ?
> sounds strange, I thought that the idea was to have only one model
> that will serve data to several views.
>
> 2010/5/6 Philippe Crave <philippe.crave at gmail.com>:
>> Hello,
>>
>> I am reading the chapter 14 of Mark Summerfield.
>> I work with custom model and custom delegate.
>>
>> in the sample from the book, we have 1 tableView linked to one model.
>> It's simple to get 2 tableView linked to the same model.
>>
>> my Model has got 4 columns.
>> I would like that TableView_1 show the 2 first column only, and
>> TableView_2 show the 2 others.
>>
>> what is the good way to do it ?
>> actually, the content of the model will be given to the view in the
>> data(self, index, role=Qt.DisplayRole) method from the custom model.
>> is there a way to know which view needs data in that data method ?
>>
>> thanks,
>>
>> Philippe
>>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
Benjamin Sonnemann


More information about the PyQt mailing list