Blocking functions cause buffer to delay output



  • Hi, I've been having this issue with PyQT for a while now. And I've been trying to solve it for over 2 months. I've had help from #pyqt and stackoverflow to no avail. Any help appreciated.

    StackOverlfow Version

    Github Issue


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you editing anything in this QTextEdit ?

    If not then you should consider using a QListView and a model to handle the data especially since you wrote that it's coming in fast.

    You can then for example trigger an update per batch of new data rather than for each line.



  • @SGaist Thanks for replying. Yeah. It's like qtconsole. I've tested this with a QPlainTextEdit and I saw very little improvement in performance. I can't sacrifice basic HTML capabilities. I am working om writing a better buffer using Qt. How would I go about checking for a batch of data ? Should I just flush or check the queue ? You may have noticed that right now it just gets something from the queue in intervals. So a lot of appends fast(but delayed). Is this the reason it's very slow ? I need speed since it's an interpreter. I am very sure that it can be done without QListView since Spyder IDE has successfully done it.

    Thanks in advance
    (^_^)



  • I'm sorry but this does not look like a bug of the system nor of the buffer, you are just blocking the event loop.

    from your stackoverflow code, if you add app.porcessEvents() inside the loop everything will work as you expect



  • @VRonin Oh yeah that was brought up a few times and I'm aware of it. But the stackoverflow version was not a good mvce. I suppose the GitHub version explains the issue better. The loop actually runs in an environment without access to qt UI or its variables. I'm still writing the buffer so will keep this posted unless I can't figure out the buffer flush myself.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.