On 29.11.10 12:42:53, Ian wrote: > 2) When you call setSortingEnabled(True) on a QTreeView the model's > sort routine is called twice. > > No sort is necessary in my use case, because the data is already sorted > correctly. However I would accept a single sort column 0, ascending. > > Besides, sorting should *always* be done in the view and never in the > model. Sorting is a matter of data presentation. A model may have many > views - and each could sort in different orders without interfering with > each other. The view has the data. > > So SortEnable should handle it all - and map the index back, so the data > in the model need not move. If the view needs to know the domain of a > column (numeric, string, character set), then it should ask the model. > > This bug has been reported since PyQt 4.4 - and is still outstanding.
Of course, reporting it against PyQt doesn't help, you need to report this to Nokia, unless you can demonstrate that the equivalent C++ code has no such problem. That being said, sorting is supposed to be done through a proxy model these days, i.e. the view doesn't work on the "real" model directly. > 3) When the bug in 2) has finished sorting the data twice, it results in > the header icon being in the wrong sense. Clicking the header continues > to sort the data in the opposite direction to that indicated by the > icon. After clicking to another column and clicking back it does > correct itself. This only effects column 0. Again sounds like a Qt (or style) bug. > - > 4) My table has exactly 5 columns of data - > ['Name','Ref','Street','Town','Contacts']. > > If I return 5 from columnCount() then I don't get any headers! If I > return 6 then the headers appear - and include an empty column on the > right. > > Anyone know a work-round for this? Post a small runnable example that reproduces this, for example by modifying one of the examples coming with PyQt. Andreas -- You have an ambitious nature and may make a name for yourself. _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
