[PyQt] Model/View programming

Philippe Crave philippe.crave at gmail.com
Thu May 6 16:15:16 BST 2010


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
>


More information about the PyQt mailing list