[PyKDE] QAbstractItemView Question
brent.villalobos at theorphanage.com
Thu Nov 16 21:18:29 GMT 2006
I'm a PyQt newbie so maybe there's an easier way, but I wrote my own. I
saved out various view attributes, swapped in a new model, and then set the
view to those saved-out variables. It works well and to the end user the
table just updates without losing any context. It's a little annoying to
code, but I was able to save out and set selections, sort order, vertical
positions, column size, and column positions.
The problem with selections is when a new model has a different number or
order of elements. For example, if the first row is selected in your
current model, then you can easily set the first row as selected when you
reload the model. However, the first row in the new model may be a
completely different element. I worked around this by designating a unique
key for each row. So instead of recording which rows are selected, I
recorded which keys were selected. Then I had to search through the new
model and find those keys and select them in the selection model.
> On 11/16/06, Matt Chambers <chambers at imageworks.com> wrote:
>> Is it possible that using one of the View classes, to reset() the model,
>> but still maintain any selections the users had on items that were in
>> the old data, and the new data?
>> PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
More information about the PyQt