How to process events during window drag/resize.



  • I have async-data being sent to my application that needs to be processed by the GUI thread. My problem is that when a window is dragged or re-sized in my application the GUI thread is blocked until the event is finished. Is there any way to change the behavior so events are processed during window drags and resizes?

    I want to multi-thread the part of my application that is handling this async-data, but part of handling the data requires me to create new GUI objects and such. I can't do this in another thread. Since the GUI thread can be blocked indefinitely by window drag or resize I'm out of luck with this approach. Even if I queue up things for the GUI thread to do while resizing/dragging occurs, I'm afraid this could crash my application if the data is never processed by the GUI thread in a timely fashion.

    Does anyone know how to solve a problem like this? Should I just assume that the user will never drag/resize the application indefinitely that would cause a crash, and then multi-thread everything?



  • That sounds like a bad design to me. Your UI should not depend on anything sent to you but your model should get updated. After your model is updated you can notify your UI that there is something new to display so this will never interfere with resizing or dragging because these events will occur one after the other.


Log in to reply
 

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