[PyQt] QTreeView + sort + delete = crash

John F Sturtz john at sturtz.org
Tue May 7 04:26:29 BST 2019


On 5/6/2019 2:00:15 AM, Florian Bruhin <me at the-compiler.org> wrote:
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.
I wasn't exactly sure what order things should go in.  In particular, should I show the dialog before qtbot.add_widget() and qtmodeltester.check(), or after?

I tried both of these:

def test_model(qtbot, qtmodeltester):
    app = QtWidgets.QApplication(sys.argv)
    app.setStyle('Fusion')
    dlg = Dlg()

    qtbot.add_widget(dlg)
    qtmodeltester.check(dlg.model)
    dlg.show()
    qtbot.stopForInteraction()

----

def test_model(qtbot, qtmodeltester):
    app = QtWidgets.QApplication(sys.argv)
    app.setStyle('Fusion')
    dlg = Dlg()

    dlg.show()
    qtbot.add_widget(dlg)
    qtmodeltester.check(dlg.model)
    qtbot.stopForInteraction()

In neither case, in the course of interacting with the widget or the listview, did the model checker report anything, right up to and including the point at which the interaction makes the app crash.

Perhaps now I can conclude the problem (probably) isn't in the model design?

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


More information about the PyQt mailing list