[PyQt] QTreeView + sort + delete = crash

Kyle Altendorf sda at fstab.net
Sun May 5 05:55:10 BST 2019


On 2019-05-04 23:08, John F Sturtz wrote:

>> On 5/3/2019 1:36:04 AM, Florian Bruhin <me at the-compiler.org> wrote:
>> 
>> You might want to try running pytest-qt's item model tester over your 
>> model:
>> https://pytest-qt.readthedocs.io/en/latest/modeltester.html
> 
> So, I think I wrapped my mind around pytest and pytest-qt enough to use 
> the model tester coherently.
> 
> If I mock up a file with the simple model shown on the Model Tester 
> documentation site 
> (https://pytest-qt.readthedocs.io/en/latest/modeltester.html) and run 
> pytest on it, I get the output I expect -- it indicates that the test 
> has run and passed (attached file img1.png).
> 
> But the model tester seems to crash on the model I posted previously.  
> The test starts to run but never finishes, and doesn't generate any 
> messages (attached file img2.png).
> 
> I must have really done something egregiously wrong.  :-/
> 
> The modified cat.py is attached (I cleaned it up a bit to make it a 
> little easier to add the tester function).

It's late so I won't promise it's testing properly...  but the attached 
.py runs the test and passes.  I'd note that you shouldn't be passing 
the view to the model.  The intention is that the Qt defined interface 
is all that is needed.  For example, what happens when you have two 
views for one model?

Cheers,
-kyle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x.py
Type: text/x-python
Size: 10794 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190505/4b15fe00/attachment.py>


More information about the PyQt mailing list