[PyQt] Reporting Bugs in PyQt/Qt

Ian hobson42 at gmail.com
Mon Nov 29 21:05:43 GMT 2010


On 29/11/2010 19:21, Andreas Pakulat wrote:
> 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
Hi Andreas,
Thank you for the pointer.

I have just googled and found the documentation that mentions this. It 
is not in the
class I am using, nor in the method I am using, nor is it very clear 
when I find it.

Hmmm.

Having chased down the definition of the role - not in the class or 
method, and not linked from either location -
then it does become a bit clearer. As a noob I had thought that I am 
only displaying, so why does the model
call for anything other than display role?

There are many references to an example which might have helped. This is at

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/itemviews-simpletreemodel.html

This gives a 404.  Double Hmmmm.

So. In my first week with Python, PyQt and Qt I have:
a) Uncovered more bugs in QT in one week, than I uncovered in all the 
software I used in my first 20 years in IT.

b) Been helped over styles three times twice here - and once in the 
Python list - with information
that was very hard to find if you did not know the exact name you were 
looking for.

Conclusion - super people, shame about the documentation, shame on Qt.

Have I just hit a bad class in QAbstractTableModel - or is all Qt as buggy?

Regards. - And thanks.

Ian













More information about the PyQt mailing list