QTableView from model

Baz Walter bazwal at gmail.com
Sun Sep 10 23:53:14 BST 2023


On 10/09/2023 15:59, Glenn Holmer wrote:
> Is there any way to get a reference to a table model's table (from the
> model)?
> 

Models can be used with multiple views, so, in general, there's no unambiguous way to achieve this. However, if you have 
control over the creation of the model, and you know it will only be used with one view, you could set the view as 
parent and then access it later via model.parent(). Having said that, though, it seems highly dubious to couple the 
model to the view in this way, so I wouldn't recommend it.


More information about the PyQt mailing list