[PyQt] Re: problem with QAbstractItemModel

Linos info at linos.es
Fri Nov 6 13:52:57 GMT 2009


Hi,
	i can reproduce the problem here with (Qt 4.5.2, PyQt 4.6.1), i had the same 
problem in one model tree i have in my code but i simply returns the children 
only if exists in the list:

if row < len(self.children):
	return self.children[row]

I suppose it is not the best way to do it but i have not had problems with this 
model anyway.

Vicent Mas escribió:
>> On Fri, 6 Nov 2009 10:22:59 +0100, Vicent Mas <uvemas at gmail.com> wrote:
>>>> Hi,
>>>>
>>>> the attached script implements a minimal tree model featuring rows
>>>>  deletion. It works just fine with (Qt 4.4, PyQt 4.4.4). However, with
>>>>  (Qt
>>>>  4.5.2, PyQt 4.5.4) and (Qt 4.5.2, PyQt 4.6.1) deleting the last row
>>>>  raises
>>>>  the following error:
>>>>
>>>> vmas at rachael:/tmp$ python tmTester.py &
>>>> [2] 6819
>>>> vmas at rachael:/tmp$ Traceback (most recent call last):
>>>>   File "tmTester.py", line 189, in index
>>>>     return self.createIndex(row, column, branch.childAtRow(row))
>>>>   File "tmTester.py", line 86, in childAtRow
>>>>     return self.children[row]
>>>> IndexError: list index out of range
>>>>
>>>> Is it a bug in the recent versions of PyQt? Or should I fix some problem
>>>> in
>>>>  the script?
>>>>
>>>> I would really appreciate your help.
>>> Hi,
>>>
>>> I'm still struggling with this problem, looking for a solution (or, at
>>> least,
>>> a workaround) with no luck. Could somebody give me a hand please? I
>> really
>>
>>> need to fix this issue.
> 
> Hi,
> 
>> Try and simplify your test case. 250+ lines isn't something people can take
>> a quick look at.
>>
> 
> Done. I've removed as much as I can. Please, let me know if it is not yet 
> enough.
> 
> Vicent
> 
> PS: when running the script, in order to remove an item select it an press 
> Del.
> 
> ::
> 
> 	Share what you know, learn what you don't
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



More information about the PyQt mailing list