[PyQt] QTreeView + sort + delete = crash

John F Sturtz john at sturtz.org
Mon May 6 17:45:23 BST 2019


On 5/6/2019 2:00:15 AM, Florian Bruhin <me at the-compiler.org> wrote:
Hey,

On Sun, May 05, 2019 at 08:52:13PM -0500, John F Sturtz wrote:
> I suspect the reason that the version I posted crashed was because I tried to
> instantiate the dialog widget (Dlg) from the tester function.  The tester
> function doesn't create a QApplication, so it was foolish of me to think it
> could create a widget there.

That should actually work, since pytest-qt creates a QApplication internally.
Oh.  Interesting.  All the same, adding in creation of a QApplication explicitly seemed to make a difference, in that the test finished with it, and didn't finish without it ...

> So, there doesn't seem to be anything obvious wrong with the model, at least
> not as far as the pytest-qt item model tester is concerned.  Which means I'm
> not much closer to knowing why the original code I posted crashes than I was
> before.  :-/

Note the model tester continues to observe your model while you interact with
it.

You might want to either find an automated way to reproduce the bug you've
seen, or add a qtbot argument, add "qtbot.add_widget(dlg)" at the beginning,
and "qtbot.stop()" after setting up the model tester.

That should allow you to interact with the widget manually while the model
checker continues to run.
Good idea.  I'll give that a try ...

Thanks again!

/John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190506/99667f27/attachment.html>


More information about the PyQt mailing list