[PyQt] Reporting Bugs in PyQt/Qt

Andreas Pakulat apaku at gmx.de
Mon Nov 29 19:21:38 GMT 2010


On 29.11.10 18:44:58, Ian wrote:
> On 29/11/2010 13:09, Andreas Pakulat wrote:
> >
> >>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
> >
> See http://homepage.ntlworld.com/ian.hobson/demo.py
> 
> This demonstrates two of the errors.
> 
> After opening, the icon in the first column shows "Ascending" and a
> click will convert it
> to "Descending", leaving the sort in "Ascending".  Click away and
> any other column works
> correctly. Click back to first column and it now works correctly.

Can't say anything about this error.

> If you edit line 50/51 as per comments, you can return the correct
> value from columnCount()
> and the headers do not appear (which makes sorting difficult).

But this one is caused because you don't take care of the role parameter
in headerData. If you only return something for Qt.DisplayRole it works.
I can't tell you why this is the case or why it works when adding +1 to
the columnCount. That would need some digging into the itemview code in
Qt.

Andreas

-- 
You will be reincarnated as a toad; and you will be much happier.


More information about the PyQt mailing list