[PyQt] Issue with selected cells in a QTableView

Vicent Mas uvemas at gmail.com
Fri Mar 11 15:15:14 GMT 2011

> Hi,
> Your code works fine without the function 'updateView(self, *value):'
> Is it necessary to use it and why ?

Sure it works fine without that method. But the script is just a
simplified code that shows a problem present in a larger and more
complex code in which that method is required.

In the real code I use table models for displaying datasets with
several thousand millions of rows (the number of rows can be a 64bits
integer). As I can't load such large datasets in memory at once I've
to use buffers and table models with dimensions much smaller than
dimensions of the real dataset. Obviously that means that I have to
refresh the data of the table model when I move upward and downward
the dataset. This is why I need an updateView method. Suppose that my
table model (which has let say 2000 rows) contains the first 2000 rows
of a dataset with 20000 rows and I've selected the cell (100, 0). If I
move downward and I reache the row 5000 of my dataset the whole data
and the selection status of the table model have to be refreshed. Now
the cell (100, 0) of the table model shouldn't be selected. But If I
go back to the first 2000 rows of the dataset then the cell (100, 0)
should be selected again.

And anyway, even if the attached script was a crazycode that I have
written just for pleasure, if it shows a bug then the bug has to be
reported, right?

Hope thinks are clearer now,


Share what you know, learn what you don't.

More information about the PyQt mailing list