This only partially solves the problem. I can emit layoutChanged signal when updating the cache, then the view class refresh the current selection. I can determine its internal pointer, which will store the primary key, but I can not change the mechanism of index comparison, because now equal indexes do not necessarily have the same row. Equal indexes should only contain the same pointer (and column), because only internal pointer need to be equal (row may change after redraw).
Maybe I overlooked a possible solution, I hope you understand my problem. Regards, Aleksey 2010/10/4 Koen Deforche <[email protected]>: > Hey Aleksey, > > 2010/9/29 Aleksey Chirkin <[email protected]>: >> If I understand correctly, you mean a way to store indexes in >> internalPointer of WModelIndex? This is a good way to restore the >> selection position when sorting or any other events emitting >> layoutChanged. But, I mean another operation - retrieving data from >> the database using cache (like Dbo QueryModel). layoutChanged not >> emits when WTableView causes data(...) method of model, although in >> reality the data may already changed since the last cache. If the db >> table data changes, the position of the selection will remain, but it >> will be another database row. > > So I indeed misunderstood the question. > > That is a problem of the model: if the model caches data then it > should cope with changes that invalidate the cached data. I believe a > database does not really give you good options to detect this (and > neither does QueryModel attempt to). What should happen is that the > model indicates row insertions and deletions when needed and not > simply changes values. > > Perhaps we need to add a virtual method refresh() to > WAbstractItemModel which is used by the view class before it starts a > rendering update which allows the model to indicate changes like these > ? > > Regards, > koen > > ------------------------------------------------------------------------------ > Virtualization is moving to the mainstream and overtaking non-virtualized > environment for deploying applications. Does it make network security > easier or more difficult to achieve? Read this whitepaper to separate the > two and get a better understanding. > http://p.sf.net/sfu/hp-phase2-d2d > _______________________________________________ > witty-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ Virtualization is moving to the mainstream and overtaking non-virtualized environment for deploying applications. Does it make network security easier or more difficult to achieve? Read this whitepaper to separate the two and get a better understanding. http://p.sf.net/sfu/hp-phase2-d2d _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
