On 09.08.10 13:31:15, Hans-Peter Jansen wrote: > On Monday 09 August 2010, 12:20:36 Andreas Pakulat wrote: > > If you use this model on a treeview you'll probably end up in an infinite > > tree size. The reason is that you're returning a child-count of 2 for > > each and every index (and the treeview is going to ask for the row-count > > of each toplevel entry). Try to add a check for index.isValid() and only > > return 2 if its not a valid index. > > Yes, that did the trick. As Peter said, this is rather counterintuitive as > an table API, but anyway. For any descendants:
See my answer to peter, there's no such thing as a 'table API' in Qt's itemviews. There's only a generic model API and thats what all views from Qt itself rely upon. > BTW, this model reveals another issue: the focus can be set to all table > items by clicking with the mouse, but only to the left column items by > keyboard. Is that to be expected? Given, above is enough to implement a > read only table, shouldn't it handle keyboard navigation properly, too? Do you mean the focus rectangle (on linux this is a small dotted line around the current item) or the normal selection? Both things are not dependent upon the actual model, only the view. Andreas -- You had some happiness once, but your parents moved away, and you had to leave it behind. _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt